mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-19 03:57:40 +02:00
btcwallet: make blockcache available to BtcWallet
This commit makes the blockcache available to BtcWallet so that any GetBlock call made to BtcWallet is wrapped by the blockcache GetBlock call.
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/btcsuite/btcwallet/chain"
|
||||
"github.com/btcsuite/btcwallet/wallet"
|
||||
"github.com/lightninglabs/neutrino"
|
||||
"github.com/lightningnetwork/lnd/blockcache"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs/bitcoindnotify"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs/btcdnotify"
|
||||
@@ -306,6 +307,9 @@ func NewChainControl(cfg *Config) (*ChainControl, func(), error) {
|
||||
"cache: %v", err)
|
||||
}
|
||||
|
||||
// Initialize a new block cache.
|
||||
blockCache := blockcache.NewBlockCache(cfg.BlockCacheSize)
|
||||
|
||||
// If spv mode is active, then we'll be using a distinct set of
|
||||
// chainControl interfaces that interface directly with the p2p network
|
||||
// of the selected chain.
|
||||
@@ -641,7 +645,7 @@ func NewChainControl(cfg *Config) (*ChainControl, func(), error) {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
wc, err := btcwallet.New(*walletConfig)
|
||||
wc, err := btcwallet.New(*walletConfig, blockCache)
|
||||
if err != nil {
|
||||
fmt.Printf("unable to create wallet controller: %v\n", err)
|
||||
return nil, ccCleanup, err
|
||||
|
Reference in New Issue
Block a user