multi: switch from bolt packge to bbolt package for all imports
This commit is contained in:
41 files changed
+404
-405
No files matched your search
@@ -207,7 +207,7 @@ func TestPackagerEmptyFwdPkg(t *testing.T) {
|
||||
// Next, create and write a new forwarding package with no htlcs.
|
||||
fwdPkg := channeldb.NewFwdPkg(shortChanID, 0, nil, nil)
|
||||
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.AddFwdPkg(tx, fwdPkg)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to add fwd pkg: %v", err)
|
||||
@@ -226,7 +226,7 @@ func TestPackagerEmptyFwdPkg(t *testing.T) {
|
||||
|
||||
// Now, write the forwarding decision. In this case, its just an empty
|
||||
// fwd filter.
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.SetFwdFilter(tx, fwdPkg.Height, fwdPkg.FwdFilter)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to set fwdfiter: %v", err)
|
||||
@@ -244,7 +244,7 @@ func TestPackagerEmptyFwdPkg(t *testing.T) {
|
||||
assertAckFilterIsFull(t, fwdPkgs[0], true)
|
||||
|
||||
// Lastly, remove the completed forwarding package from disk.
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.RemovePkg(tx, fwdPkg.Height)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to remove fwdpkg: %v", err)
|
||||
@@ -279,7 +279,7 @@ func TestPackagerOnlyAdds(t *testing.T) {
|
||||
|
||||
nAdds := len(adds)
|
||||
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.AddFwdPkg(tx, fwdPkg)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to add fwd pkg: %v", err)
|
||||
@@ -300,7 +300,7 @@ func TestPackagerOnlyAdds(t *testing.T) {
|
||||
// added any adds to the fwdfilter, this would indicate that all of the
|
||||
// adds were 1) settled locally by this link (exit hop), or 2) the htlc
|
||||
// was failed locally.
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.SetFwdFilter(tx, fwdPkg.Height, fwdPkg.FwdFilter)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to set fwdfiter: %v", err)
|
||||
@@ -324,7 +324,7 @@ func TestPackagerOnlyAdds(t *testing.T) {
|
||||
Index: uint16(i),
|
||||
}
|
||||
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.AckAddHtlcs(tx, addRef)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to ack add htlc: %v", err)
|
||||
@@ -343,7 +343,7 @@ func TestPackagerOnlyAdds(t *testing.T) {
|
||||
assertAckFilterIsFull(t, fwdPkgs[0], true)
|
||||
|
||||
// Lastly, remove the completed forwarding package from disk.
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.RemovePkg(tx, fwdPkg.Height)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to remove fwdpkg: %v", err)
|
||||
@@ -381,7 +381,7 @@ func TestPackagerOnlySettleFails(t *testing.T) {
|
||||
|
||||
nSettleFails := len(settleFails)
|
||||
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.AddFwdPkg(tx, fwdPkg)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to add fwd pkg: %v", err)
|
||||
@@ -402,7 +402,7 @@ func TestPackagerOnlySettleFails(t *testing.T) {
|
||||
// added any adds to the fwdfilter, this would indicate that all of the
|
||||
// adds were 1) settled locally by this link (exit hop), or 2) the htlc
|
||||
// was failed locally.
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.SetFwdFilter(tx, fwdPkg.Height, fwdPkg.FwdFilter)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to set fwdfiter: %v", err)
|
||||
@@ -428,7 +428,7 @@ func TestPackagerOnlySettleFails(t *testing.T) {
|
||||
Index: uint16(i),
|
||||
}
|
||||
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.AckSettleFails(tx, failSettleRef)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to ack add htlc: %v", err)
|
||||
@@ -448,7 +448,7 @@ func TestPackagerOnlySettleFails(t *testing.T) {
|
||||
assertAckFilterIsFull(t, fwdPkgs[0], true)
|
||||
|
||||
// Lastly, remove the completed forwarding package from disk.
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.RemovePkg(tx, fwdPkg.Height)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to remove fwdpkg: %v", err)
|
||||
@@ -486,7 +486,7 @@ func TestPackagerAddsThenSettleFails(t *testing.T) {
|
||||
nAdds := len(adds)
|
||||
nSettleFails := len(settleFails)
|
||||
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.AddFwdPkg(tx, fwdPkg)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to add fwd pkg: %v", err)
|
||||
@@ -507,7 +507,7 @@ func TestPackagerAddsThenSettleFails(t *testing.T) {
|
||||
// added any adds to the fwdfilter, this would indicate that all of the
|
||||
// adds were 1) settled locally by this link (exit hop), or 2) the htlc
|
||||
// was failed locally.
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.SetFwdFilter(tx, fwdPkg.Height, fwdPkg.FwdFilter)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to set fwdfiter: %v", err)
|
||||
@@ -532,7 +532,7 @@ func TestPackagerAddsThenSettleFails(t *testing.T) {
|
||||
Index: uint16(i),
|
||||
}
|
||||
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.AckAddHtlcs(tx, addRef)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to ack add htlc: %v", err)
|
||||
@@ -559,7 +559,7 @@ func TestPackagerAddsThenSettleFails(t *testing.T) {
|
||||
Index: uint16(i),
|
||||
}
|
||||
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.AckSettleFails(tx, failSettleRef)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to remove settle/fail htlc: %v", err)
|
||||
@@ -579,7 +579,7 @@ func TestPackagerAddsThenSettleFails(t *testing.T) {
|
||||
assertAckFilterIsFull(t, fwdPkgs[0], true)
|
||||
|
||||
// Lastly, remove the completed forwarding package from disk.
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.RemovePkg(tx, fwdPkg.Height)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to remove fwdpkg: %v", err)
|
||||
@@ -619,7 +619,7 @@ func TestPackagerSettleFailsThenAdds(t *testing.T) {
|
||||
nAdds := len(adds)
|
||||
nSettleFails := len(settleFails)
|
||||
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.AddFwdPkg(tx, fwdPkg)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to add fwd pkg: %v", err)
|
||||
@@ -640,7 +640,7 @@ func TestPackagerSettleFailsThenAdds(t *testing.T) {
|
||||
// added any adds to the fwdfilter, this would indicate that all of the
|
||||
// adds were 1) settled locally by this link (exit hop), or 2) the htlc
|
||||
// was failed locally.
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.SetFwdFilter(tx, fwdPkg.Height, fwdPkg.FwdFilter)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to set fwdfiter: %v", err)
|
||||
@@ -669,7 +669,7 @@ func TestPackagerSettleFailsThenAdds(t *testing.T) {
|
||||
Index: uint16(i),
|
||||
}
|
||||
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.AckSettleFails(tx, failSettleRef)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to remove settle/fail htlc: %v", err)
|
||||
@@ -696,7 +696,7 @@ func TestPackagerSettleFailsThenAdds(t *testing.T) {
|
||||
Index: uint16(i),
|
||||
}
|
||||
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.AckAddHtlcs(tx, addRef)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to ack add htlc: %v", err)
|
||||
@@ -716,7 +716,7 @@ func TestPackagerSettleFailsThenAdds(t *testing.T) {
|
||||
assertAckFilterIsFull(t, fwdPkgs[0], true)
|
||||
|
||||
// Lastly, remove the completed forwarding package from disk.
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
||||
return packager.RemovePkg(tx, fwdPkg.Height)
|
||||
}); err != nil {
|
||||
t.Fatalf("unable to remove fwdpkg: %v", err)
|
||||
@@ -778,11 +778,11 @@ func assertSettleFailFilterIsFull(t *testing.T, fwdPkg *channeldb.FwdPkg, expect
|
||||
|
||||
// loadFwdPkgs is a helper method that reads all forwarding packages for a
|
||||
// particular packager.
|
||||
func loadFwdPkgs(t *testing.T, db *bolt.DB,
|
||||
func loadFwdPkgs(t *testing.T, db *bbolt.DB,
|
||||
packager channeldb.FwdPackager) []*channeldb.FwdPkg {
|
||||
|
||||
var fwdPkgs []*channeldb.FwdPkg
|
||||
if err := db.View(func(tx *bolt.Tx) error {
|
||||
if err := db.View(func(tx *bbolt.Tx) error {
|
||||
var err error
|
||||
fwdPkgs, err = packager.LoadFwdPkgs(tx)
|
||||
return err
|
||||
@@ -795,7 +795,7 @@ func loadFwdPkgs(t *testing.T, db *bolt.DB,
|
||||
|
||||
// makeFwdPkgDB initializes a test database for forwarding packages. If the
|
||||
// provided path is an empty, it will create a temp dir/file to use.
|
||||
func makeFwdPkgDB(t *testing.T, path string) *bolt.DB {
|
||||
func makeFwdPkgDB(t *testing.T, path string) *bbolt.DB {
|
||||
if path == "" {
|
||||
var err error
|
||||
path, err = ioutil.TempDir("", "fwdpkgdb")
|
||||
@@ -806,7 +806,7 @@ func makeFwdPkgDB(t *testing.T, path string) *bolt.DB {
|
||||
path = filepath.Join(path, "fwdpkg.db")
|
||||
}
|
||||
|
||||
db, err := bolt.Open(path, 0600, nil)
|
||||
db, err := bbolt.Open(path, 0600, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to open boltdb: %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user