multi: init neutrino backend with block cache

This commit initializes the nwutrino backend with the lnd blockcache so
that the two can share a block cache instead of each having its own.
This commit is contained in:
Elle Mouton
2021-03-24 08:48:33 +02:00
parent a0f7bf8b2d
commit ecf20ed350
2 changed files with 13 additions and 7 deletions

View File

@@ -235,7 +235,8 @@ type ChainControl struct {
// full-node, another backed by a running bitcoind full-node, and the other
// backed by a running neutrino light client instance. When running with a
// neutrino light client instance, `neutrinoCS` must be non-nil.
func NewChainControl(cfg *Config) (*ChainControl, func(), error) {
func NewChainControl(cfg *Config, blockCache *blockcache.BlockCache) (
*ChainControl, func(), error) {
// Set the RPC config from the "home" chain. Multi-chain isn't yet
// active, so we'll restrict usage to a particular chain for now.
@@ -307,9 +308,6 @@ 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.