bitcoin/src/wallet
Matt Corallo 17220d6325 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."
2017-10-13 19:30:14 -04:00
..
test Merge #7061: [Wallet] Add RPC call "rescanblockchain <startheight> <stopheight>" 2017-10-13 15:23:22 -07:00
coincontrol.h Make QT fee displays use GetMinimumFee instead of estimateSmartFee 2017-07-14 23:41:37 -04:00
crypter.cpp Changing &vec[0] to vec.data(), what 9804 missed 2017-09-08 10:36:26 +12:00
crypter.h Merge #11107: Fix races in AppInitMain and others with lock and atomic bools 2017-10-05 15:03:36 +02:00
db.cpp Merge #10845: Remove unreachable code 2017-09-06 21:44:18 +02:00
db.h Refactor: Modernize disallowed copy constructors/assignment 2017-09-16 13:06:05 +03:00
feebumper.cpp Merge #10976: [MOVEONLY] Move some static functions out of wallet.h/cpp 2017-08-25 21:30:42 +02:00
feebumper.h Refactor to use CoinControl in GetMinimumFee and FeeBumper 2017-07-14 23:10:58 -04:00
fees.cpp MOVEONLY: Fee functions wallet/wallet.cpp -> wallet/fees.cpp 2017-08-14 11:19:38 -04:00
fees.h Move some static functions out of wallet.h/cpp 2017-08-14 11:19:38 -04:00
init.cpp Merge #11250: Bump wallet version to 159900 and remove the usehd option 2017-09-08 02:28:12 +02:00
init.h [trivial] fixup comment for VerifyWallets() 2017-09-07 16:22:11 -07:00
rpcdump.cpp Update importprivkey named args documentation 2017-10-09 07:40:42 -04:00
rpcwallet.cpp Add calls to CWallet::BlockUntilSyncedToCurrentChain() in RPCs 2017-10-13 19:29:54 -04:00
rpcwallet.h [wallet] Add RegisterWalletRPC() function to wallet/init.cpp 2017-09-07 16:21:26 -07:00
wallet.cpp Use callbacks to cache whether wallet transactions are in mempool 2017-10-13 19:30:14 -04:00
wallet.h Use callbacks to cache whether wallet transactions are in mempool 2017-10-13 19:30:14 -04:00
walletdb.cpp Fix parameter name typo in ErasePurpose walletdb method. 2017-09-26 18:02:09 -04:00
walletdb.h Refactor: Modernize disallowed copy constructors/assignment 2017-09-16 13:06:05 +03:00