v29.4-roots.4 · Commit 3: [PATCH 03/37] policy: restore conservative relay and network controls
test/functional/mempool_ephemeral_dust.py
Before: test/functional/mempool_ephemeral_dust.py · After: test/functional/mempool_ephemeral_dust.py
File metadata
index 8963c3b5cb018fb3286cc4d1c02395b39bb06b29..4400c796a5bd50282d25e71b70147245a1854194 100755
Download original patch · Release notes
Diff rows 1–81 of 81. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
test/functional/mempool_ephemeral_dust.py
CHANGED
|
@@ -20,10 +20,13 @@ from test_framework.wallet import (
|
|
| 20 |
MiniWallet,
|
| 21 |
)
|
| 22 |
|
|
|
|
|
|
|
| 23 |
class EphemeralDustTest(BitcoinTestFramework):
|
| 24 |
def set_test_params(self):
|
| 25 |
# Mempools should match via 1P1C p2p relay
|
| 26 |
self.num_nodes = 2
|
|
|
|
| 27 |
|
| 28 |
# Don't test trickling logic
|
| 29 |
self.noban_tx_relay = True
|
|
@@ -129,8 +132,8 @@ class EphemeralDustTest(BitcoinTestFramework):
|
|
| 129 |
# Node restart; doesn't allow ephemeral transaction back in due to individual submission
|
| 130 |
# resulting in 0-fee. Supporting re-submission of CPFP packages on restart is desired but not
|
| 131 |
# yet implemented.
|
| 132 |
-
self.restart_node(0)
|
| 133 |
-
self.restart_node(1)
|
| 134 |
self.connect_nodes(0, 1)
|
| 135 |
assert_mempool_contents(self, self.nodes[0], expected=[])
|
| 136 |
|
|
@@ -190,8 +193,8 @@ class EphemeralDustTest(BitcoinTestFramework):
|
|
| 190 |
self.log.info("Test that a single output of any satoshi amount is allowed, not checking spending")
|
| 191 |
|
| 192 |
# We aren't checking spending, allow it in with no fee
|
| 193 |
-
self.restart_node(0, extra_args=["-minrelaytxfee=0"])
|
| 194 |
-
self.restart_node(1, extra_args=["-minrelaytxfee=0"])
|
| 195 |
self.connect_nodes(0, 1)
|
| 196 |
|
| 197 |
# 330 is dust threshold for taproot outputs
|
|
@@ -201,8 +204,8 @@ class EphemeralDustTest(BitcoinTestFramework):
|
|
| 201 |
test_res = self.nodes[0].testmempoolaccept([dusty_tx["hex"]])
|
| 202 |
assert test_res[0]["allowed"]
|
| 203 |
|
| 204 |
-
self.restart_node(0, extra_args=[])
|
| 205 |
-
self.restart_node(1, extra_args=[])
|
| 206 |
self.connect_nodes(0, 1)
|
| 207 |
assert_mempool_contents(self, self.nodes[0], expected=[])
|
| 208 |
|
|
@@ -215,7 +218,9 @@ class EphemeralDustTest(BitcoinTestFramework):
|
|
| 215 |
|
| 216 |
res = self.nodes[0].submitpackage([dusty_tx["hex"], sweep_tx["hex"]])
|
| 217 |
assert_equal(res["package_msg"], "transaction failed")
|
| 218 |
-
assert_equal(res["tx-results"][dusty_tx["wtxid"]]["error"], "min relay fee not met, 0 < 15")
|
|
|
|
|
|
|
| 219 |
|
| 220 |
assert_equal(self.nodes[0].getrawmempool(), [])
|
| 221 |
|
|
@@ -350,7 +355,7 @@ class EphemeralDustTest(BitcoinTestFramework):
|
|
| 350 |
|
| 351 |
# TRUC transactions restriction for ephemeral dust disallows further spends of ancestor chains
|
| 352 |
child_tx = self.wallet.create_self_transfer_multi(utxos_to_spend=sweep_tx_2["new_utxos"], version=3)
|
| 353 |
-
assert_raises_rpc_error(-26, "TRUC-violation", self.nodes[0].sendrawtransaction, child_tx["hex"])
|
| 354 |
|
| 355 |
self.nodes[0].reconsiderblock(reconsider_block_res["hash"])
|
| 356 |
assert_equal(self.nodes[0].getrawmempool(), [])
|
|
@@ -376,8 +381,8 @@ class EphemeralDustTest(BitcoinTestFramework):
|
|
| 376 |
self.log.info("Test that ephemeral dust works in non-TRUC contexts when there's no minrelay requirement")
|
| 377 |
|
| 378 |
# Note: since minrelay is 0, it is not testing 1P1C relay
|
| 379 |
-
self.restart_node(0, extra_args=["-minrelaytxfee=0"])
|
| 380 |
-
self.restart_node(1, extra_args=["-minrelaytxfee=0"])
|
| 381 |
self.connect_nodes(0, 1)
|
| 382 |
|
| 383 |
assert_equal(self.nodes[0].getrawmempool(), [])
|
|
@@ -441,8 +446,8 @@ class EphemeralDustTest(BitcoinTestFramework):
|
|
| 441 |
|
| 442 |
# Other topology tests (e.g., grandparents and parents both with dust) require relaxation of submitpackage topology
|
| 443 |
|
| 444 |
-
self.restart_node(0, extra_args=[])
|
| 445 |
-
self.restart_node(1, extra_args=[])
|
| 446 |
self.connect_nodes(0, 1)
|
| 447 |
|
| 448 |
assert_equal(self.nodes[0].getrawmempool(), [])
|
|
|
|
| 20 |
MiniWallet,
|
| 21 |
)
|
| 22 |
|
| 23 |
+
EPHEMERAL_ARGS = ["-permitephemeral=anchor,send,dust", "-subdustfeepenalty=0", "-blockprioritysize=0"]
|
| 24 |
+
|
| 25 |
class EphemeralDustTest(BitcoinTestFramework):
|
| 26 |
def set_test_params(self):
|
| 27 |
# Mempools should match via 1P1C p2p relay
|
| 28 |
self.num_nodes = 2
|
| 29 |
+
self.extra_args = [EPHEMERAL_ARGS, EPHEMERAL_ARGS]
|
| 30 |
|
| 31 |
# Don't test trickling logic
|
| 32 |
self.noban_tx_relay = True
|
|
|
|
| 132 |
# Node restart; doesn't allow ephemeral transaction back in due to individual submission
|
| 133 |
# resulting in 0-fee. Supporting re-submission of CPFP packages on restart is desired but not
|
| 134 |
# yet implemented.
|
| 135 |
+
self.restart_node(0, extra_args=EPHEMERAL_ARGS)
|
| 136 |
+
self.restart_node(1, extra_args=EPHEMERAL_ARGS)
|
| 137 |
self.connect_nodes(0, 1)
|
| 138 |
assert_mempool_contents(self, self.nodes[0], expected=[])
|
| 139 |
|
|
|
|
| 193 |
self.log.info("Test that a single output of any satoshi amount is allowed, not checking spending")
|
| 194 |
|
| 195 |
# We aren't checking spending, allow it in with no fee
|
| 196 |
+
self.restart_node(0, extra_args=EPHEMERAL_ARGS + ["-minrelaytxfee=0"])
|
| 197 |
+
self.restart_node(1, extra_args=EPHEMERAL_ARGS + ["-minrelaytxfee=0"])
|
| 198 |
self.connect_nodes(0, 1)
|
| 199 |
|
| 200 |
# 330 is dust threshold for taproot outputs
|
|
|
|
| 204 |
test_res = self.nodes[0].testmempoolaccept([dusty_tx["hex"]])
|
| 205 |
assert test_res[0]["allowed"]
|
| 206 |
|
| 207 |
+
self.restart_node(0, extra_args=EPHEMERAL_ARGS)
|
| 208 |
+
self.restart_node(1, extra_args=EPHEMERAL_ARGS)
|
| 209 |
self.connect_nodes(0, 1)
|
| 210 |
assert_mempool_contents(self, self.nodes[0], expected=[])
|
| 211 |
|
|
|
|
| 218 |
|
| 219 |
res = self.nodes[0].submitpackage([dusty_tx["hex"], sweep_tx["hex"]])
|
| 220 |
assert_equal(res["package_msg"], "transaction failed")
|
| 221 |
+
# Roots accounts for the datacarrier policy weight in this package's
|
| 222 |
+
# individual relay-fee check.
|
| 223 |
+
assert_equal(res["tx-results"][dusty_tx["wtxid"]]["error"], "min relay fee not met, 0 < 147")
|
| 224 |
|
| 225 |
assert_equal(self.nodes[0].getrawmempool(), [])
|
| 226 |
|
|
|
|
| 355 |
|
| 356 |
# TRUC transactions restriction for ephemeral dust disallows further spends of ancestor chains
|
| 357 |
child_tx = self.wallet.create_self_transfer_multi(utxos_to_spend=sweep_tx_2["new_utxos"], version=3)
|
| 358 |
+
assert_raises_rpc_error(-26, "truc-ancestors-toomany", self.nodes[0].sendrawtransaction, child_tx["hex"])
|
| 359 |
|
| 360 |
self.nodes[0].reconsiderblock(reconsider_block_res["hash"])
|
| 361 |
assert_equal(self.nodes[0].getrawmempool(), [])
|
|
|
|
| 381 |
self.log.info("Test that ephemeral dust works in non-TRUC contexts when there's no minrelay requirement")
|
| 382 |
|
| 383 |
# Note: since minrelay is 0, it is not testing 1P1C relay
|
| 384 |
+
self.restart_node(0, extra_args=EPHEMERAL_ARGS + ["-minrelaytxfee=0"])
|
| 385 |
+
self.restart_node(1, extra_args=EPHEMERAL_ARGS + ["-minrelaytxfee=0"])
|
| 386 |
self.connect_nodes(0, 1)
|
| 387 |
|
| 388 |
assert_equal(self.nodes[0].getrawmempool(), [])
|
|
|
|
| 446 |
|
| 447 |
# Other topology tests (e.g., grandparents and parents both with dust) require relaxation of submitpackage topology
|
| 448 |
|
| 449 |
+
self.restart_node(0, extra_args=EPHEMERAL_ARGS)
|
| 450 |
+
self.restart_node(1, extra_args=EPHEMERAL_ARGS)
|
| 451 |
self.connect_nodes(0, 1)
|
| 452 |
|
| 453 |
assert_equal(self.nodes[0].getrawmempool(), [])
|