build: silence new linter errors, tidy modules
The explicit `bbolt` dep is gone, as we depend on `kvdb`, which is actually `walletdb`, which has its own module that defines the proper `bbolt` version.
This commit is contained in:
7 files changed
+12
-19
No files matched your search
@@ -764,7 +764,7 @@ func fetchChanBucket(tx kvdb.ReadTx, nodeKey *btcec.PublicKey,
|
||||
// channel's data resides in given: the public key for the node, the outpoint,
|
||||
// and the chainhash that the channel resides on. This differs from
|
||||
// fetchChanBucket in that it returns a writeable bucket.
|
||||
func fetchChanBucketRw(tx kvdb.RwTx, nodeKey *btcec.PublicKey,
|
||||
func fetchChanBucketRw(tx kvdb.RwTx, nodeKey *btcec.PublicKey, // nolint:interfacer
|
||||
outPoint *wire.OutPoint, chainHash chainhash.Hash) (kvdb.RwBucket, error) {
|
||||
|
||||
readBucket, err := fetchChanBucket(tx, nodeKey, outPoint, chainHash)
|
||||
@@ -2465,7 +2465,7 @@ func (c *OpenChannel) CloseChannel(summary *ChannelCloseSummary,
|
||||
|
||||
// Now that the index to this channel has been deleted, purge
|
||||
// the remaining channel metadata from the database.
|
||||
err = deleteOpenChannel(chanBucket, chanPointBuf.Bytes())
|
||||
err = deleteOpenChannel(chanBucket)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -3108,7 +3108,7 @@ func fetchChanRevocationState(chanBucket kvdb.ReadBucket, channel *OpenChannel)
|
||||
return ReadElements(r, &channel.RemoteNextRevocation)
|
||||
}
|
||||
|
||||
func deleteOpenChannel(chanBucket kvdb.RwBucket, chanPointBytes []byte) error {
|
||||
func deleteOpenChannel(chanBucket kvdb.RwBucket) error {
|
||||
|
||||
if err := chanBucket.Delete(chanInfoKey); err != nil {
|
||||
return err
|
||||
|
||||
@@ -795,7 +795,7 @@ func loadFwdPkgs(t *testing.T, db kvdb.Backend,
|
||||
|
||||
// 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) kvdb.Backend {
|
||||
func makeFwdPkgDB(t *testing.T, path string) kvdb.Backend { // nolint:unparam
|
||||
if path == "" {
|
||||
var err error
|
||||
path, err = ioutil.TempDir("", "fwdpkgdb")
|
||||
|
||||
+2
-2
@@ -328,7 +328,7 @@ func (c *ChannelGraph) DisabledChannelIDs() ([]uint64, error) {
|
||||
//
|
||||
// TODO(roasbeef): add iterator interface to allow for memory efficient graph
|
||||
// traversal when graph gets mega
|
||||
func (c *ChannelGraph) ForEachNode(tx kvdb.RwTx, cb func(kvdb.ReadTx, *LightningNode) error) error {
|
||||
func (c *ChannelGraph) ForEachNode(tx kvdb.RwTx, cb func(kvdb.ReadTx, *LightningNode) error) error { // nolint:interfacer
|
||||
traversal := func(tx kvdb.ReadTx) error {
|
||||
// First grab the nodes bucket which stores the mapping from
|
||||
// pubKey to node information.
|
||||
@@ -3328,7 +3328,7 @@ func (c *ChannelGraph) NumZombies() (uint64, error) {
|
||||
return numZombies, nil
|
||||
}
|
||||
|
||||
func putLightningNode(nodeBucket kvdb.RwBucket, aliasBucket kvdb.RwBucket,
|
||||
func putLightningNode(nodeBucket kvdb.RwBucket, aliasBucket kvdb.RwBucket, // nolint:dupl
|
||||
updateIndex kvdb.RwBucket, node *LightningNode) error {
|
||||
|
||||
var (
|
||||
|
||||
@@ -345,15 +345,17 @@ func TestMigrationWithoutErrors(t *testing.T) {
|
||||
|
||||
// Populate database with initial data.
|
||||
beforeMigrationFunc := func(d *DB) {
|
||||
kvdb.Update(d, func(tx kvdb.RwTx) error {
|
||||
err := kvdb.Update(d, func(tx kvdb.RwTx) error {
|
||||
bucket, err := tx.CreateTopLevelBucket(bucketPrefix)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
bucket.Put(keyPrefix, beforeMigration)
|
||||
return nil
|
||||
return bucket.Put(keyPrefix, beforeMigration)
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("unable to update db pre migration: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Create migration function which changes the initially created data.
|
||||
|
||||
Reference in new issue
Block a user