diff options
author | Matt Corallo <git@bluematt.me> | 2017-01-20 16:38:07 -0500 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2017-10-13 19:30:14 -0400 |
commit | 17220d6325ef8d7789373055586e4332977077b0 (patch) | |
tree | 6a2f87e2ad43fbd785f498f97d187a871d89079e /src/compressor.h | |
parent | 5d67a7868db188f7e43ce9028f215034d057790d (diff) |
Use callbacks to cache whether wallet transactions are in mempool
This avoid calling out to mempool state during coin selection,
balance calculation, etc. In the next commit we ensure all wallet
callbacks from CValidationInterface happen in the same queue,
serialized with each other. This helps to avoid re-introducing one
of the issues described in #9584 [1] by further disconnecting
wallet from current chain/mempool state.
Thanks to @morcos for the suggestion to do this.
Note that there are several race conditions introduced here:
* If a user calls sendrawtransaction from RPC, adding a
transaction which is "trusted" (ie from them) and pays them
change, it may not be immediately used by coin selection until
the notification callbacks finish running. No such race is
introduced in normal transaction-sending RPCs as this case is
explicitly handled.
* Until Block{Connected,Disconnected} and
TransactionAddedToMempool calls also run in the CSceduler
background thread, there is a race where
TransactionAddedToMempool might be called after a
Block{Connected,Disconnected} call happens.
* Wallet will write a new best chain from the SetBestChain
callback prior to having processed the transaction from that
block.
[1] "you could go to select coins, need to use 0-conf change, but
such 0-conf change may have been included in a block who's
callbacks have not yet been processed - resulting in thinking they
are not in mempool and, thus, not selectable."
Diffstat (limited to 'src/compressor.h')
0 files changed, 0 insertions, 0 deletions