Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 3: [PATCH 03/68] feat(policy): preserve Roots relay and network controls on Core 30.3

test/functional/mempool_ephemeral_dust.py

Before: test/functional/mempool_ephemeral_dust.py · After: test/functional/mempool_ephemeral_dust.py

File metadata
index a0308da72acb62f660f01273fc5e8692fe8cd437..6ecfff842bee3674969dec6e9f5d681b62daebe1 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
@@ -21,10 +21,13 @@ from test_framework.wallet import (
21
  MiniWallet,
22
  )
23
 
 
 
24
  class EphemeralDustTest(BitcoinTestFramework):
25
  def set_test_params(self):
26
  # Mempools should match via 1P1C p2p relay
27
  self.num_nodes = 2
 
28
 
29
  # Don't test trickling logic
30
  self.noban_tx_relay = True
@@ -130,8 +133,8 @@ class EphemeralDustTest(BitcoinTestFramework):
130
  # Node restart; doesn't allow ephemeral transaction back in due to individual submission
131
  # resulting in 0-fee. Supporting re-submission of CPFP packages on restart is desired but not
132
  # yet implemented.
133
- self.restart_node(0)
134
- self.restart_node(1)
135
  self.connect_nodes(0, 1)
136
  assert_mempool_contents(self, self.nodes[0], expected=[])
137
 
@@ -191,8 +194,8 @@ class EphemeralDustTest(BitcoinTestFramework):
191
  self.log.info("Test that a single output of any satoshi amount is allowed, not checking spending")
192
 
193
  # We aren't checking spending, allow it in with no fee
194
- self.restart_node(0, extra_args=["-minrelaytxfee=0"])
195
- self.restart_node(1, extra_args=["-minrelaytxfee=0"])
196
  self.connect_nodes(0, 1)
197
 
198
  # 330 is dust threshold for taproot outputs
@@ -202,8 +205,8 @@ class EphemeralDustTest(BitcoinTestFramework):
202
  test_res = self.nodes[0].testmempoolaccept([dusty_tx["hex"]])
203
  assert test_res[0]["allowed"]
204
 
205
- self.restart_node(0, extra_args=[])
206
- self.restart_node(1, extra_args=[])
207
  self.connect_nodes(0, 1)
208
  assert_mempool_contents(self, self.nodes[0], expected=[])
209
 
@@ -216,7 +219,9 @@ class EphemeralDustTest(BitcoinTestFramework):
216
 
217
  res = self.nodes[0].submitpackage([dusty_tx["hex"], sweep_tx["hex"]])
218
  assert_equal(res["package_msg"], "transaction failed")
219
- assert_equal(res["tx-results"][dusty_tx["wtxid"]]["error"], "min relay fee not met, 0 < 15")
 
 
220
 
221
  assert_equal(self.nodes[0].getrawmempool(), [])
222
 
@@ -351,7 +356,7 @@ class EphemeralDustTest(BitcoinTestFramework):
351
 
352
  # TRUC transactions restriction for ephemeral dust disallows further spends of ancestor chains
353
  child_tx = self.wallet.create_self_transfer_multi(utxos_to_spend=sweep_tx_2["new_utxos"], version=3)
354
- assert_raises_rpc_error(-26, "TRUC-violation", self.nodes[0].sendrawtransaction, child_tx["hex"])
355
 
356
  self.nodes[0].reconsiderblock(reconsider_block_res["hash"])
357
  assert_equal(self.nodes[0].getrawmempool(), [])
@@ -377,8 +382,8 @@ class EphemeralDustTest(BitcoinTestFramework):
377
  self.log.info("Test that ephemeral dust works in non-TRUC contexts when there's no minrelay requirement")
378
 
379
  # Note: since minrelay is 0, it is not testing 1P1C relay
380
- self.restart_node(0, extra_args=["-minrelaytxfee=0"])
381
- self.restart_node(1, extra_args=["-minrelaytxfee=0"])
382
  self.connect_nodes(0, 1)
383
 
384
  assert_equal(self.nodes[0].getrawmempool(), [])
@@ -442,8 +447,8 @@ class EphemeralDustTest(BitcoinTestFramework):
442
 
443
  # Other topology tests (e.g., grandparents and parents both with dust) require relaxation of submitpackage topology
444
 
445
- self.restart_node(0, extra_args=[])
446
- self.restart_node(1, extra_args=[])
447
  self.connect_nodes(0, 1)
448
 
449
  assert_equal(self.nodes[0].getrawmempool(), [])
 
21
  MiniWallet,
22
  )
23
 
24
+ EPHEMERAL_ARGS = ["-permitephemeral=anchor,send,dust", "-subdustfeepenalty=0", "-blockprioritysize=0"]
25
+
26
  class EphemeralDustTest(BitcoinTestFramework):
27
  def set_test_params(self):
28
  # Mempools should match via 1P1C p2p relay
29
  self.num_nodes = 2
30
+ self.extra_args = [EPHEMERAL_ARGS, EPHEMERAL_ARGS]
31
 
32
  # Don't test trickling logic
33
  self.noban_tx_relay = True
 
133
  # Node restart; doesn't allow ephemeral transaction back in due to individual submission
134
  # resulting in 0-fee. Supporting re-submission of CPFP packages on restart is desired but not
135
  # yet implemented.
136
+ self.restart_node(0, extra_args=EPHEMERAL_ARGS)
137
+ self.restart_node(1, extra_args=EPHEMERAL_ARGS)
138
  self.connect_nodes(0, 1)
139
  assert_mempool_contents(self, self.nodes[0], expected=[])
140
 
 
194
  self.log.info("Test that a single output of any satoshi amount is allowed, not checking spending")
195
 
196
  # We aren't checking spending, allow it in with no fee
197
+ self.restart_node(0, extra_args=EPHEMERAL_ARGS + ["-minrelaytxfee=0"])
198
+ self.restart_node(1, extra_args=EPHEMERAL_ARGS + ["-minrelaytxfee=0"])
199
  self.connect_nodes(0, 1)
200
 
201
  # 330 is dust threshold for taproot outputs
 
205
  test_res = self.nodes[0].testmempoolaccept([dusty_tx["hex"]])
206
  assert test_res[0]["allowed"]
207
 
208
+ self.restart_node(0, extra_args=EPHEMERAL_ARGS)
209
+ self.restart_node(1, extra_args=EPHEMERAL_ARGS)
210
  self.connect_nodes(0, 1)
211
  assert_mempool_contents(self, self.nodes[0], expected=[])
212
 
 
219
 
220
  res = self.nodes[0].submitpackage([dusty_tx["hex"], sweep_tx["hex"]])
221
  assert_equal(res["package_msg"], "transaction failed")
222
+ # Roots accounts for the datacarrier policy weight in this package's
223
+ # individual relay-fee check.
224
+ assert_equal(res["tx-results"][dusty_tx["wtxid"]]["error"], "min relay fee not met, 0 < 147")
225
 
226
  assert_equal(self.nodes[0].getrawmempool(), [])
227
 
 
356
 
357
  # TRUC transactions restriction for ephemeral dust disallows further spends of ancestor chains
358
  child_tx = self.wallet.create_self_transfer_multi(utxos_to_spend=sweep_tx_2["new_utxos"], version=3)
359
+ assert_raises_rpc_error(-26, "truc-ancestors-toomany", self.nodes[0].sendrawtransaction, child_tx["hex"])
360
 
361
  self.nodes[0].reconsiderblock(reconsider_block_res["hash"])
362
  assert_equal(self.nodes[0].getrawmempool(), [])
 
382
  self.log.info("Test that ephemeral dust works in non-TRUC contexts when there's no minrelay requirement")
383
 
384
  # Note: since minrelay is 0, it is not testing 1P1C relay
385
+ self.restart_node(0, extra_args=EPHEMERAL_ARGS + ["-minrelaytxfee=0"])
386
+ self.restart_node(1, extra_args=EPHEMERAL_ARGS + ["-minrelaytxfee=0"])
387
  self.connect_nodes(0, 1)
388
 
389
  assert_equal(self.nodes[0].getrawmempool(), [])
 
447
 
448
  # Other topology tests (e.g., grandparents and parents both with dust) require relaxation of submitpackage topology
449
 
450
+ self.restart_node(0, extra_args=EPHEMERAL_ARGS)
451
+ self.restart_node(1, extra_args=EPHEMERAL_ARGS)
452
  self.connect_nodes(0, 1)
453
 
454
  assert_equal(self.nodes[0].getrawmempool(), [])