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. The two line-number columns refer to before and after.

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