multi: switch from bolt packge to bbolt package for all imports

This commit is contained in:
Olaoluwa Osuntokun
2018-11-29 20:04:21 -08:00
parent 0edf1ae081
commit 1fd3aac925
41 changed files with 404 additions and 405 deletions

View File

@@ -56,7 +56,7 @@ type DecayedLog struct {
dbPath string
db *bolt.DB
db *bbolt.DB
notifier chainntnfs.ChainNotifier
@@ -92,7 +92,7 @@ func (d *DecayedLog) Start() error {
// Open the boltdb for use.
var err error
if d.db, err = bolt.Open(d.dbPath, dbPermissions, nil); err != nil {
if d.db, err = bbolt.Open(d.dbPath, dbPermissions, nil); err != nil {
return fmt.Errorf("Could not open boltdb: %v", err)
}
@@ -119,7 +119,7 @@ func (d *DecayedLog) Start() error {
// initBuckets initializes the primary buckets used by the decayed log, namely
// the shared hash bucket, and batch replay
func (d *DecayedLog) initBuckets() error {
return d.db.Update(func(tx *bolt.Tx) error {
return d.db.Update(func(tx *bbolt.Tx) error {
_, err := tx.CreateBucketIfNotExists(sharedHashBucket)
if err != nil {
return ErrDecayedLogInit
@@ -196,7 +196,7 @@ func (d *DecayedLog) garbageCollector(epochClient *chainntnfs.BlockEpochEvent) {
func (d *DecayedLog) gcExpiredHashes(height uint32) (uint32, error) {
var numExpiredHashes uint32
err := d.db.Batch(func(tx *bolt.Tx) error {
err := d.db.Batch(func(tx *bbolt.Tx) error {
numExpiredHashes = 0
// Grab the shared hash bucket
@@ -246,7 +246,7 @@ func (d *DecayedLog) gcExpiredHashes(height uint32) (uint32, error) {
// Delete removes a <shared secret hash, CLTV> key-pair from the
// sharedHashBucket.
func (d *DecayedLog) Delete(hash *sphinx.HashPrefix) error {
return d.db.Batch(func(tx *bolt.Tx) error {
return d.db.Batch(func(tx *bbolt.Tx) error {
sharedHashes := tx.Bucket(sharedHashBucket)
if sharedHashes == nil {
return ErrDecayedLogCorrupted
@@ -261,7 +261,7 @@ func (d *DecayedLog) Delete(hash *sphinx.HashPrefix) error {
func (d *DecayedLog) Get(hash *sphinx.HashPrefix) (uint32, error) {
var value uint32
err := d.db.View(func(tx *bolt.Tx) error {
err := d.db.View(func(tx *bbolt.Tx) error {
// Grab the shared hash bucket which stores the mapping from
// truncated sha-256 hashes of shared secrets to CLTV's.
sharedHashes := tx.Bucket(sharedHashBucket)
@@ -294,7 +294,7 @@ func (d *DecayedLog) Put(hash *sphinx.HashPrefix, cltv uint32) error {
var scratch [4]byte
binary.BigEndian.PutUint32(scratch[:], cltv)
return d.db.Batch(func(tx *bolt.Tx) error {
return d.db.Batch(func(tx *bbolt.Tx) error {
sharedHashes := tx.Bucket(sharedHashBucket)
if sharedHashes == nil {
return ErrDecayedLogCorrupted
@@ -327,7 +327,7 @@ func (d *DecayedLog) PutBatch(b *sphinx.Batch) (*sphinx.ReplaySet, error) {
// to generate the complete replay set. If this batch was previously
// processed, the replay set will be deserialized from disk.
var replays *sphinx.ReplaySet
if err := d.db.Batch(func(tx *bolt.Tx) error {
if err := d.db.Batch(func(tx *bbolt.Tx) error {
sharedHashes := tx.Bucket(sharedHashBucket)
if sharedHashes == nil {
return ErrDecayedLogCorrupted