bitcoin/src
Samuel Dobson ac61ec9da6
Merge #17843: wallet: Reset reused transactions cache
6fc554f591 wallet: Reset reused transactions cache (Fabian Jahr)

Pull request description:

  Fixes #17603 (together with #17824)

  `getbalances` is using the cache within `GetAvailableCredit` under certain conditions [here](35fff5be60/src/wallet/wallet.cpp (L1826)). For a wallet with `avoid_reuse` activated this can lead to inconsistent reporting of `used` transactions/balances between `getbalances` and `listunspent` as pointed out in #17603. When an address is reused before the first transaction is spending from this address, the cache is not updated even after the transaction is sent. This means the remaining outputs at the reused address are not showing up as `used` in `getbalances`.

  With this change, any newly incoming transaction belonging to the wallet marks all the other outputs at the same address as dirty.

ACKs for top commit:
  kallewoof:
    Code review re-ACK 6fc554f591
  promag:
    ACK 6fc554f591.
  achow101:
    Re-ACK 6fc554f591
  meshcollider:
    Code review ACK 6fc554f591

Tree-SHA512: c4cad2c752176d16d77b4a4202291d20baddf9f27250896a40274d74a6945e0f6b34be04c2f9b1b2e756d3ac669b794969df8f82a98e0b16f10e92f276649ea2
2020-01-15 22:11:33 +13:00
..
bench scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
compat scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
config
consensus scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
crypto scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
index scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
interfaces scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
leveldb Pull leveldb subtree 2019-01-26 12:45:48 -05:00
logging scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
node scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
policy scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
primitives scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
qt Merge #17923: refactor: Use PACKAGE_NAME in GUI modal overlay and bitcoin-wallet 2020-01-15 14:19:42 +08:00
rpc scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
script scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
secp256k1 Update the secp256k1 subtree to the latest upstream version 2019-03-31 11:41:05 -07:00
support scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
test scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
univalue Update univalue subtree 2019-10-30 16:24:02 -04:00
util scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
wallet Merge #17843: wallet: Reset reused transactions cache 2020-01-15 22:11:33 +13:00
zmq scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
.clang-format util: Add AllowShortCaseLabelsOnASingleLine option 2019-10-14 13:24:54 +03:00
addrdb.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
addrdb.h Convert addrdb/addrman to new serialization 2020-01-02 11:05:36 -08:00
addrman.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
addrman.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
amount.h Update copyright headers to 2018 2018-12-29 10:15:01 +01:00
arith_uint256.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
arith_uint256.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
attributes.h Add NODISCARD to all {Decode,Parse}[...](...) functions returning bool. Sort includes. 2018-11-05 17:03:11 +01:00
banman.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
banman.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
base58.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
base58.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
bech32.cpp Add some general std::vector utility functions 2019-10-16 08:56:57 -07:00
bech32.h Assert that the HRP is lowercase in Bech32::Encode 2019-09-05 13:25:11 +12:00
bitcoin-cli-res.rc
bitcoin-cli.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
bitcoin-tx-res.rc
bitcoin-tx.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
bitcoin-wallet-res.rc [tools] Add wallet inspection and modification tool 2019-01-30 16:26:52 -05:00
bitcoin-wallet.cpp bitcoin-wallet: Use PACKAGE_NAME in usage help 2020-01-14 18:19:00 +00:00
bitcoind-res.rc
bitcoind.cpp Merge #16839: Replace Connman and BanMan globals with NodeContext local 2019-10-30 12:35:41 +01:00
blockencodings.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
blockencodings.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
blockfilter.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
blockfilter.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
bloom.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
bloom.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chain.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chain.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chainparams.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chainparams.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chainparamsbase.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chainparamsbase.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chainparamsseeds.h contrib: Remove invalid nodes from seeds list 2019-10-02 08:51:12 +02:00
checkqueue.h
clientversion.cpp
clientversion.h
coins.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
coins.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
compat.h windows: Set _WIN32_WINNT to 0x0601 (Windows 7) 2019-01-23 16:28:27 +08:00
compressor.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
compressor.h
core_io.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
core_memusage.h
core_read.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
core_write.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
cuckoocache.h Use correct C++11 header for std::swap() 2019-11-29 21:23:25 +02:00
dbwrapper.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
dbwrapper.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
dummywallet.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
flatfile.cpp Style cleanup. 2019-02-22 17:38:45 -08:00
flatfile.h Style cleanup. 2019-02-22 17:38:45 -08:00
fs.cpp Fix occurences of c_str() used with size() to data() 2019-10-28 13:41:45 +01:00
fs.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
hash.cpp Extract CSipHasher to it's own file in crypto/ directory. 2018-11-05 09:25:15 -08:00
hash.h Squashed 'src/secp256k1/' changes from 0b70241850..b19c000063 2019-03-31 11:41:05 -07:00
httprpc.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
httprpc.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
httpserver.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
httpserver.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
indirectmap.h
init.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
init.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
key_io.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
key_io.h
key.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
key.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
limitedmap.h
logging.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
logging.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
Makefile.am build: remove double LIBBITCOIN_SERVER linking 2020-01-12 08:49:40 +08:00
Makefile.bench.include [test] move wallet helper functions into test library 2019-11-25 16:40:09 +01:00
Makefile.leveldb.include build: Remove WINVER pre define in Makefile.leveldb.inlcude 2019-01-26 09:28:48 +08:00
Makefile.qt_locale.include Restore English translation option 2020-01-06 22:58:47 -05:00
Makefile.qt.include Merge #17513: refactor, qt: Nuke some circular dependencies 2019-11-21 19:38:39 +01:00
Makefile.qttest.include build: Create test utility library from src/test/util/ 2019-11-21 21:13:08 +01:00
Makefile.test_util.include [test] move wallet helper functions into test library 2019-11-25 16:40:09 +01:00
Makefile.test.include Merge #16945: refactor: introduce CChainState::GetCoinsCacheSizeState 2020-01-13 12:42:38 +01:00
memusage.h
merkleblock.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
merkleblock.h
miner.cpp rpc: Remove mempool global from miner 2019-12-23 06:12:10 +07:00
miner.h rpc: Remove mempool global from miner 2019-12-23 06:12:10 +07:00
net_permissions.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
net_permissions.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
net_processing.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
net_processing.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
net_types.h refactor: Remove addrdb.h dependency from node.h 2019-10-29 11:30:12 +02:00
net.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
net.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
netaddress.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
netaddress.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
netbase.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
netbase.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
netmessagemaker.h
noui.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
noui.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
optional.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
outputtype.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
outputtype.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
pow.cpp
pow.h
prevector.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
protocol.cpp p2p: Remove BIP61 reject messages 2019-10-02 10:39:14 -04:00
protocol.h Merge #17474: Bugfix: GUI: Recognise NETWORK_LIMITED in formatServicesStr 2019-12-11 17:00:27 -05:00
psbt.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
psbt.h Merge #17524: psbt: handle unspendable psbts 2019-12-10 12:12:10 -05:00
pubkey.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
pubkey.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
random.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
random.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
randomenv.cpp Put bounds on the number of CPUID leaves explored 2019-11-20 10:54:08 -08:00
randomenv.h [MOVEONLY] Move perfmon data gathering to new randomenv module 2019-11-12 14:50:44 -08:00
rest.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
reverse_iterator.h
reverselock.h
scheduler.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
scheduler.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
serialize.h Introduce new serialization macros without casts 2020-01-02 11:05:27 -08:00
shutdown.cpp
shutdown.h
span.h
streams.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
sync.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
sync.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
threadinterrupt.cpp
threadinterrupt.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
threadsafety.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
timedata.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
timedata.h
tinyformat.h util: Update tinyformat to upstream 2019-12-06 10:02:08 +01:00
torcontrol.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
torcontrol.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
txdb.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
txdb.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
txmempool.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
txmempool.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
ui_interface.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
ui_interface.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
uint256.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
uint256.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
undo.h Extract CSipHasher to it's own file in crypto/ directory. 2018-11-05 09:25:15 -08:00
validation.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
validation.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
validationinterface.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
validationinterface.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
version.h
versionbits.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
versionbits.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
versionbitsinfo.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
versionbitsinfo.h MOVEONLY: Move versionbits info out of versionbits.o 2018-09-23 22:55:11 +02:00
walletinitinterface.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
warnings.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
warnings.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00