Commit graph

17 commits

Author SHA1 Message Date
Wilmer Paulino
5124978a9b
chain: prevent filtering blocks when BitcoindClient has an empty filter 2019-08-09 18:16:40 -07:00
Wilmer Paulino
4a913d02ea
chain: only allow bitcoind block notifications at tip after NotifyBlocks
One could argue that the behavior before this commit was incorrect, as
the ChainClient interface expects a call to NotifyBlocks before
notifying blocks at tip, so we decide to fix this.

Since we now wait for the chain backend to be considered "current"
before proceeding to sync the wallet with it, any blocks that were
processed while waiting would result in being notified and scanned
twice, once by processing it at tip, and another while rescanning the
wallet, which is not desirable.
2019-06-13 18:09:06 -07:00
Wilmer Paulino
39f81c630b
chain: add IsCurrent method to chain.Interface
IsCurrent allows us to determine if the chain backend considers itself
"current" with the chain.
2019-06-13 18:08:59 -07:00
Wilmer Paulino
0efe836773
chain: avoid using defer for BitcoindClient onRescanFinished notification
Since defer will copy the function with the parameters evaluated at its
invocation, the RescanFinished notification would be dispatched with the
incorrect block. To fix this, we'll just send the notification at the
end ourselves manually.
2019-05-11 13:06:25 -07:00
Wilmer Paulino
28161bee42
chain: improve error logging within BitcoindClient.reorg 2019-05-11 13:05:27 -07:00
Wilmer Paulino
ecfebcea03
chain: remove unnecessary returned error from BitcoindClient.filterBlock 2019-05-11 13:05:23 -07:00
Wilmer Paulino
ec210ad79c
chain/bitcoind_client: extend filterTx with script spend support
In this commit, we extend the BitcoindClient to properly detect the
spend of an arbitrary script on-chain. This is possible by looking at a
transaction's input and re-deriving the PkScript, from its signature
script/witness, of the output it's attempting to spend. Upon detecting
the spend, a chain.RelevantTx will be dispatched.
2019-01-14 18:38:45 -08:00
Wilmer Paulino
1ddb9f2c11
chain: allow setting the client's birthday after creation 2018-09-12 14:24:30 -07:00
Wilmer Paulino
d6155a55e9
chain: improve error when filtering blocks and transactions 2018-08-15 17:37:04 -07:00
Wilmer Paulino
8357e86a4d chain: match transaction against currently watched transactions
In this commit, we extend the client's filtering process to also look at
the set of currently watched transactions. The logic to watch for
transaction hashes was previously there, but it was not used to filter
against incoming transactions.
2018-07-30 17:54:08 -07:00
Wilmer Paulino
00428d5828 chain: share the same bitcoind connection between multiple rescan clients 2018-07-30 17:54:08 -07:00
Wilmer Paulino
27e22b1f79 chain: return err when updating the rescan filter while shutting down 2018-07-30 14:55:56 -07:00
Wilmer Paulino
0b269d799e
chain: send empty struct instance rather than bool to reset filters 2018-07-26 16:38:58 -07:00
Wilmer Paulino
7df2b72beb
chain: switch BitcoindClient to use atomic started/stopped pattern 2018-07-26 16:38:57 -07:00
Wilmer Paulino
1aeead0eeb
chain: keep track of the best block within BitcoindClient
In the previous commit, we modified our BitcoindClient struct to use a
ConcurrentQueue struct to handle its notifications to the caller. Before
this, the BitcoindClient had a goroutine that would handle these
notifications in the background and detect when a OnBlockConnected
notification was received in order to update the best block. Due to this
logic being removed, we now keep track of the best block througout the
struct as a whole.
2018-07-26 16:38:56 -07:00
Wilmer Paulino
2091ac0936
chain: use ConcurrentQueue within BitcoindClient to handle event notifications 2018-07-26 16:38:55 -07:00
Wilmer Paulino
8e9e4d6926
chain: rename bitcoind.go to bitcoind_client.go 2018-07-26 16:38:38 -07:00
Renamed from chain/bitcoind.go (Browse further)