diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-10-29 12:55:48 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-10-29 12:55:51 +0200 |
commit | 8bac3b1096410960c19957b16c544058726b51cc (patch) | |
tree | 2ec300bc8495d006679c4152fabcd72073f7e2fd /test/functional/wallet_multiwallet.py | |
parent | c426e0dc6f051b4020a6eef1fd815f430fec4832 (diff) | |
parent | d2c4904ef707e2023ceb8dfbfe61a92c4060e100 (diff) | |
download | bitcoin-8bac3b1096410960c19957b16c544058726b51cc.tar.xz |
Merge bitcoin/bitcoin#23375: test: MiniWallet: more deterministic coin selection for coinbase UTXOs (oldest first)
d2c4904ef707e2023ceb8dfbfe61a92c4060e100 test: MiniWallet: more deterministic coin selection for coinbase UTXOs (oldest first) (Sebastian Falbesoner)
Pull request description:
The coin selection strategy for MiniWallet is quite straight-forward: simply pick a single UTXO with the largest value:
https://github.com/bitcoin/bitcoin/blob/ab25ef8c7f767258d5fe44f53b35ad8bd51ed5cd/test/functional/test_framework/wallet.py#L173-L174
If there are several candidates with the same value, however, it is not clear which one is taken. This can be particularly problematic for coinbase outputs with fixed block subsidy, since spending could lead to a `bad-txns-premature-spend-of-coinbase` reject if an UTXO from a too-recent block is picked. Introduce block height as second criteria (saved in `self._utxos` in the methods `generate(...)` and `rescan_utxos(...)`), in order to avoid potential issues with coinbases that are not matured yet. If there is a tie between coinbase UTXOs and non-coinbase UTXOs (the latter are added via `scan_tx(...)`), prefer the non-coinbase UTXOs, since those don't need to mature.
The issue came up while refactoring the test rpc_blockchain.py, see https://github.com/bitcoin/bitcoin/pull/23371#discussion_r737401936 (PR #23371).
ACKs for top commit:
MarcoFalke:
review ACK d2c4904ef707e2023ceb8dfbfe61a92c4060e100
shaavan:
ACK d2c4904ef707e2023ceb8dfbfe61a92c4060e100
Tree-SHA512: 15d67b42fb8b77fd53022ea2ab8a6ed2b615567f3ce73bab16c06bfcb687c1a04dcb0360d0c2287c526b604cd3ac5eef7b14ce46fc31e23047ce1a3290027306
Diffstat (limited to 'test/functional/wallet_multiwallet.py')
0 files changed, 0 insertions, 0 deletions