Merge pull request #644 from wpaulino/notify-on-not-filtered

chain: notify block when not filtered for BitcoindClient
This commit is contained in:
Olaoluwa Osuntokun 2019-09-11 09:57:39 +03:00 committed by GitHub
commit d5cdeb4b91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1152,7 +1152,14 @@ func (c *BitcoindClient) filterBlock(block *wire.MsgBlock, height int32,
// If this block happened before the client's birthday or we have // If this block happened before the client's birthday or we have
// nothing to filter for, then we'll skip it entirely. // nothing to filter for, then we'll skip it entirely.
blockHash := block.BlockHash()
if !c.shouldFilterBlock(block.Header.Timestamp) { if !c.shouldFilterBlock(block.Header.Timestamp) {
if notify {
c.onFilteredBlockConnected(height, &block.Header, nil)
c.onBlockConnected(
&blockHash, height, block.Header.Timestamp,
)
}
return nil return nil
} }
@ -1163,7 +1170,6 @@ func (c *BitcoindClient) filterBlock(block *wire.MsgBlock, height int32,
// Create a block details template to use for all of the confirmed // Create a block details template to use for all of the confirmed
// transactions found within this block. // transactions found within this block.
blockHash := block.BlockHash()
blockDetails := &btcjson.BlockDetails{ blockDetails := &btcjson.BlockDetails{
Hash: blockHash.String(), Hash: blockHash.String(),
Height: height, Height: height,