chain: remove unnecessary returned error from BitcoindClient.filterBlock
This commit is contained in:
parent
8d6dd92706
commit
ecfebcea03
1 changed files with 7 additions and 19 deletions
|
@ -336,7 +336,7 @@ func (c *BitcoindClient) RescanBlocks(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
relevantTxs, err := c.filterBlock(block, header.Height, false)
|
relevantTxs := c.filterBlock(block, header.Height, false)
|
||||||
if len(relevantTxs) > 0 {
|
if len(relevantTxs) > 0 {
|
||||||
rescannedBlock := btcjson.RescannedBlock{
|
rescannedBlock := btcjson.RescannedBlock{
|
||||||
Hash: hash.String(),
|
Hash: hash.String(),
|
||||||
|
@ -567,14 +567,7 @@ func (c *BitcoindClient) ntfnHandler() {
|
||||||
c.bestBlockMtx.Unlock()
|
c.bestBlockMtx.Unlock()
|
||||||
if newBlock.Header.PrevBlock == bestBlock.Hash {
|
if newBlock.Header.PrevBlock == bestBlock.Hash {
|
||||||
newBlockHeight := bestBlock.Height + 1
|
newBlockHeight := bestBlock.Height + 1
|
||||||
_, err := c.filterBlock(
|
_ = c.filterBlock(newBlock, newBlockHeight, true)
|
||||||
newBlock, newBlockHeight, true,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Unable to filter block %v: %v",
|
|
||||||
newBlock.BlockHash(), err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// With the block succesfully filtered, we'll
|
// With the block succesfully filtered, we'll
|
||||||
// make it our new best block.
|
// make it our new best block.
|
||||||
|
@ -843,10 +836,7 @@ func (c *BitcoindClient) reorg(currentBlock waddrmgr.BlockStamp,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = c.filterBlock(nextBlock, nextHeight, true)
|
_ = c.filterBlock(nextBlock, nextHeight, true)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
currentBlock.Height = nextHeight
|
currentBlock.Height = nextHeight
|
||||||
currentBlock.Hash = nextHash
|
currentBlock.Hash = nextHash
|
||||||
|
@ -1065,9 +1055,7 @@ func (c *BitcoindClient) rescan(start chainhash.Hash) error {
|
||||||
headers.PushBack(previousHeader)
|
headers.PushBack(previousHeader)
|
||||||
|
|
||||||
// Notify the block and any of its relevant transacations.
|
// Notify the block and any of its relevant transacations.
|
||||||
if _, err = c.filterBlock(block, i, true); err != nil {
|
_ = c.filterBlock(block, i, true)
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if i%10000 == 0 {
|
if i%10000 == 0 {
|
||||||
c.onRescanProgress(
|
c.onRescanProgress(
|
||||||
|
@ -1101,12 +1089,12 @@ func (c *BitcoindClient) rescan(start chainhash.Hash) error {
|
||||||
// filterBlock filters a block for watched outpoints and addresses, and returns
|
// filterBlock filters a block for watched outpoints and addresses, and returns
|
||||||
// any matching transactions, sending notifications along the way.
|
// any matching transactions, sending notifications along the way.
|
||||||
func (c *BitcoindClient) filterBlock(block *wire.MsgBlock, height int32,
|
func (c *BitcoindClient) filterBlock(block *wire.MsgBlock, height int32,
|
||||||
notify bool) ([]*wtxmgr.TxRecord, error) {
|
notify bool) []*wtxmgr.TxRecord {
|
||||||
|
|
||||||
// If this block happened before the client's birthday, then we'll skip
|
// If this block happened before the client's birthday, then we'll skip
|
||||||
// it entirely.
|
// it entirely.
|
||||||
if block.Header.Timestamp.Before(c.birthday) {
|
if block.Header.Timestamp.Before(c.birthday) {
|
||||||
return nil, nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.shouldNotifyBlocks() {
|
if c.shouldNotifyBlocks() {
|
||||||
|
@ -1162,7 +1150,7 @@ func (c *BitcoindClient) filterBlock(block *wire.MsgBlock, height int32,
|
||||||
c.onBlockConnected(&blockHash, height, block.Header.Timestamp)
|
c.onBlockConnected(&blockHash, height, block.Header.Timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
return relevantTxs, nil
|
return relevantTxs
|
||||||
}
|
}
|
||||||
|
|
||||||
// filterTx determines whether a transaction is relevant to the client by
|
// filterTx determines whether a transaction is relevant to the client by
|
||||||
|
|
Loading…
Reference in a new issue