diff options
author | Ava Chow <github@achow101.com> | 2024-05-09 16:54:18 -0400 |
---|---|---|
committer | Ava Chow <github@achow101.com> | 2024-05-09 16:54:18 -0400 |
commit | 24572cf768167c0e82a688e7eaef865a5cbc4ffd (patch) | |
tree | e51a108cccba3862a795ab83a5cd08abac6241be /test/functional/p2p_opportunistic_1p1c.py | |
parent | 012e540acee4c06dbade5451e76c606f987e5957 (diff) | |
parent | dd8fa861939d5b8bdd844ad7cab015d08533a91a (diff) | |
download | bitcoin-24572cf768167c0e82a688e7eaef865a5cbc4ffd.tar.xz |
Merge bitcoin/bitcoin#29939: test: add MiniWallet tagging support to avoid UTXO mixing, use in `fill_mempool`
dd8fa861939d5b8bdd844ad7cab015d08533a91a test: use tagged ephemeral MiniWallet instance in fill_mempool (Sebastian Falbesoner)
b2037ad4aeb4e16c7eb1e5756d0d1ee20172344b test: add MiniWallet tagging support to avoid UTXO mixing (Sebastian Falbesoner)
c8e6d08236ff225db445009bf513d6d25def8eb2 test: refactor: eliminate COINBASE_MATURITY magic number in fill_mempool (Sebastian Falbesoner)
4f347140b1a31237597dd1821adcde8bd5761edc test: refactor: move fill_mempool to new module mempool_util (Sebastian Falbesoner)
Pull request description:
Different MiniWallet instances using the same mode (either ADDRESS_OP_TRUE, RAW_OP_TRUE or RAW_P2PK) currently always create and spend UTXOs with identical output scripts, which can cause unintentional tx dependencies (see e.g. the discussion in https://github.com/bitcoin/bitcoin/pull/29827#discussion_r1565443465). In order to avoid mixing of UTXOs between instances, this PR introduces the possibility to provide a MiniWallet tag name, that is used to derive a different internal key for the taproot construction, leading to a different P2TR output script. Note that since we use script-path spending and only the key-path is changed here, no changes in the MiniWallet spending logic are needed.
The new tagging option is then used in the `fill_mempool` helper to create an ephemeral wallet for the filling txs, as suggested in https://github.com/bitcoin/bitcoin/pull/29827#discussion_r1565964264. To avoid circular dependencies, `fill_mempool` is moved to a new module `mempool_util.py` first.
I'm still not sure if a generic word like "tag" is the right term for what this tries to achieve, happy to pick up better suggestions. Also, maybe passing a tag name is overkill and a boolean flag like "random_output_script" is sufficient?
ACKs for top commit:
glozow:
ACK dd8fa861939
achow101:
ACK dd8fa861939d5b8bdd844ad7cab015d08533a91a
rkrux:
tACK [dd8fa86](https://github.com/bitcoin/bitcoin/pull/29939/commits/dd8fa861939d5b8bdd844ad7cab015d08533a91a)
brunoerg:
utACK dd8fa861939d5b8bdd844ad7cab015d08533a91a
Tree-SHA512: 5ef3558c3ef5ac32cfa79c8f751972ca6bceaa332cd7daac7e93412a88e30dec472cb041c0845b04abf8a317036d31ebddfc3234e609ed442417894c2bdeeac9
Diffstat (limited to 'test/functional/p2p_opportunistic_1p1c.py')
-rwxr-xr-x | test/functional/p2p_opportunistic_1p1c.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/functional/p2p_opportunistic_1p1c.py b/test/functional/p2p_opportunistic_1p1c.py index e07acd5481..aec6e95fbc 100755 --- a/test/functional/p2p_opportunistic_1p1c.py +++ b/test/functional/p2p_opportunistic_1p1c.py @@ -8,6 +8,9 @@ Test opportunistic 1p1c package submission logic. from decimal import Decimal import time +from test_framework.mempool_util import ( + fill_mempool, +) from test_framework.messages import ( CInv, CTxInWitness, @@ -24,7 +27,6 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, assert_greater_than, - fill_mempool, ) from test_framework.wallet import ( MiniWallet, @@ -386,8 +388,7 @@ class PackageRelayTest(BitcoinTestFramework): self.generate(self.wallet_nonsegwit, 10) self.generate(self.wallet, 20) - filler_wallet = MiniWallet(node) - fill_mempool(self, node, filler_wallet) + fill_mempool(self, node) self.log.info("Check opportunistic 1p1c logic when parent (txid != wtxid) is received before child") self.test_basic_parent_then_child(self.wallet) |