diff --git a/chainntnfs/interface_test.go b/chainntnfs/interface_test.go index c11b3c1e..62a8bbc1 100644 --- a/chainntnfs/interface_test.go +++ b/chainntnfs/interface_test.go @@ -22,7 +22,14 @@ import ( "github.com/roasbeef/btcd/wire" "github.com/roasbeef/btcutil" + // Required to auto-register the btcd backed ChainNotifier + // implementation. _ "github.com/lightningnetwork/lnd/chainntnfs/btcdnotify" + + // Required to auto-register the neutrino backed ChainNotifier + // implementation. + _ "github.com/lightningnetwork/lnd/chainntnfs/neutrinonotify" + _ "github.com/roasbeef/btcwallet/walletdb/bdb" // Required to register the boltdb walletdb implementation. ) diff --git a/routing/chainview/interface_test.go b/routing/chainview/interface_test.go index ef15d871..5fcee2e9 100644 --- a/routing/chainview/interface_test.go +++ b/routing/chainview/interface_test.go @@ -156,7 +156,7 @@ func testFilterBlockNotifications(node *rpctest.Harness, case filteredBlock := <-blockChan: assertFilteredBlock(t, filteredBlock, currentHeight, newBlockHashes[0], []*chainhash.Hash{}) - case <-time.After(time.Second * 10): + case <-time.After(time.Second * 20): t.Fatalf("filtered block notification didn't arrive") } @@ -229,7 +229,7 @@ func testFilterBlockNotifications(node *rpctest.Harness, case filteredBlock := <-blockChan: assertFilteredBlock(t, filteredBlock, currentHeight+1, newBlockHashes[0], []*chainhash.Hash{spendTxid1}) - case <-time.After(time.Second * 10): + case <-time.After(time.Second * 20): t.Fatalf("filtered block notification didn't arrive") } @@ -248,7 +248,7 @@ func testFilterBlockNotifications(node *rpctest.Harness, case filteredBlock := <-blockChan: assertFilteredBlock(t, filteredBlock, currentHeight+2, newBlockHashes[0], []*chainhash.Hash{spendTxid2}) - case <-time.After(time.Second * 10): + case <-time.After(time.Second * 20): t.Fatalf("filtered block notification didn't arrive") } } @@ -282,7 +282,7 @@ func testUpdateFilterBackTrack(node *rpctest.Harness, chainView FilteredChainVie case filteredBlock := <-blockChan: assertFilteredBlock(t, filteredBlock, currentHeight, initBlockHashes[0], []*chainhash.Hash{}) - case <-time.After(time.Second * 10): + case <-time.After(time.Second * 20): t.Fatalf("filtered block notification didn't arrive") } @@ -314,7 +314,7 @@ func testUpdateFilterBackTrack(node *rpctest.Harness, chainView FilteredChainVie case filteredBlock := <-blockChan: assertFilteredBlock(t, filteredBlock, currentHeight+1, newBlockHashes[0], []*chainhash.Hash{}) - case <-time.After(time.Second * 10): + case <-time.After(time.Second * 20): t.Fatalf("filtered block notification didn't arrive") } @@ -332,7 +332,7 @@ func testUpdateFilterBackTrack(node *rpctest.Harness, chainView FilteredChainVie case filteredBlock := <-blockChan: assertFilteredBlock(t, filteredBlock, currentHeight+1, newBlockHashes[0], []*chainhash.Hash{spendTxid}) - case <-time.After(time.Second * 10): + case <-time.After(time.Second * 20): t.Fatalf("filtered block notification didn't arrive") } } @@ -373,7 +373,7 @@ func testFilterSingleBlock(node *rpctest.Harness, chainView FilteredChainView, case filteredBlock := <-blockChan: assertFilteredBlock(t, filteredBlock, currentHeight, newBlockHashes[0], []*chainhash.Hash{}) - case <-time.After(time.Second * 10): + case <-time.After(time.Second * 20): t.Fatalf("filtered block notification didn't arrive") } @@ -414,7 +414,7 @@ func testFilterSingleBlock(node *rpctest.Harness, chainView FilteredChainView, case filteredBlock := <-blockChan: assertFilteredBlock(t, filteredBlock, currentHeight+1, block.Hash(), []*chainhash.Hash{}) - case <-time.After(time.Second * 10): + case <-time.After(time.Second * 20): t.Fatalf("filtered block notification didn't arrive") } diff --git a/routing/chainview/neutrino.go b/routing/chainview/neutrino.go index 03313c49..a769b8ae 100644 --- a/routing/chainview/neutrino.go +++ b/routing/chainview/neutrino.go @@ -258,7 +258,12 @@ func (c *CfFilteredChainView) FilterBlock(blockHash *chainhash.Hash) (*FilteredB for _, tx := range block.Transactions() { for _, txIn := range tx.MsgTx().TxIn { prevOp := txIn.PreviousOutPoint - if _, ok := c.chainFilter[prevOp]; ok { + + c.filterMtx.RLock() + _, ok := c.chainFilter[prevOp] + c.filterMtx.RUnlock() + + if ok { filteredTxns = append(filteredTxns, tx.MsgTx()) c.filterMtx.Lock()