channeldb: change walletdb dependency to kvdb
This commit is contained in:
parent
a0ab96de5d
commit
ffb27284df
@ -6,7 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/btcsuite/btcwallet/walletdb"
|
"github.com/lightningnetwork/lnd/channeldb/kvdb"
|
||||||
"github.com/lightningnetwork/lnd/routing/route"
|
"github.com/lightningnetwork/lnd/routing/route"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ type FlapCount struct {
|
|||||||
// bucket for the peer's pubkey if necessary. Note that this function overwrites
|
// bucket for the peer's pubkey if necessary. Note that this function overwrites
|
||||||
// the current value.
|
// the current value.
|
||||||
func (d *DB) WriteFlapCounts(flapCounts map[route.Vertex]*FlapCount) error {
|
func (d *DB) WriteFlapCounts(flapCounts map[route.Vertex]*FlapCount) error {
|
||||||
return d.Update(func(tx walletdb.ReadWriteTx) error {
|
return kvdb.Update(d, func(tx kvdb.RwTx) error {
|
||||||
// Run through our set of flap counts and record them for
|
// Run through our set of flap counts and record them for
|
||||||
// each peer, creating a bucket for the peer pubkey if required.
|
// each peer, creating a bucket for the peer pubkey if required.
|
||||||
for peer, flapCount := range flapCounts {
|
for peer, flapCount := range flapCounts {
|
||||||
@ -88,7 +88,7 @@ func (d *DB) WriteFlapCounts(flapCounts map[route.Vertex]*FlapCount) error {
|
|||||||
func (d *DB) ReadFlapCount(pubkey route.Vertex) (*FlapCount, error) {
|
func (d *DB) ReadFlapCount(pubkey route.Vertex) (*FlapCount, error) {
|
||||||
var flapCount FlapCount
|
var flapCount FlapCount
|
||||||
|
|
||||||
if err := d.View(func(tx walletdb.ReadTx) error {
|
if err := kvdb.View(d, func(tx kvdb.RTx) error {
|
||||||
peers := tx.ReadBucket(peersBucket)
|
peers := tx.ReadBucket(peersBucket)
|
||||||
|
|
||||||
peerBucket := peers.NestedReadBucket(pubkey[:])
|
peerBucket := peers.NestedReadBucket(pubkey[:])
|
||||||
|
Loading…
Reference in New Issue
Block a user