Skip to content
Bitcoin Roots

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

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