Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 6: [PATCH 06/68] test(policy): preserve native dust and Roots penalty coverage

test/functional/mempool_dust.py

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

File metadata
index 937e77fbd41ba47416b991c57de1056f5f0b61f0..342850eabba10736b6afb52ee45395e666a3bf57 100755

Download original patch · Release notes

Diff rows 1–46 of 46. 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_dust.py CHANGED
@@ -35,12 +35,13 @@ from test_framework.wallet_util import generate_keypair
35
35
 
36
36
 
37
37
  DUST_RELAY_TX_FEE = 3000 # default setting [sat/kvB]
38
+ DUST_POLICY_ARGS = ["-permitbaremultisig=1", "-permitbarepubkey=1"]
38
39
 
39
40
 
40
41
  class DustRelayFeeTest(BitcoinTestFramework):
41
42
  def set_test_params(self):
42
43
  self.num_nodes = 1
43
- self.extra_args = [['-permitbaremultisig']]
44
+ self.extra_args = [DUST_POLICY_ARGS]
44
45
 
45
46
  def test_dust_output(self, node: TestNode, dust_relay_fee: Decimal,
46
47
  output_script: CScript, type_desc: str) -> None:
@@ -66,7 +67,7 @@ class DustRelayFeeTest(BitcoinTestFramework):
66
67
  tx.vout[1].nValue -= 1
67
68
  res = node.testmempoolaccept([tx.serialize().hex()])[0]
68
69
  assert_equal(res['allowed'], False)
69
- assert_equal(res['reject-reason'], 'dust')
70
+ assert_equal(res['reject-reason'], 'dust-nonanchor')
70
71
 
71
72
  # finally send the transaction to avoid running out of MiniWallet UTXOs
72
73
  self.wallet.sendrawtransaction(from_node=node, tx_hex=tx_good_hex)
@@ -74,7 +75,7 @@ class DustRelayFeeTest(BitcoinTestFramework):
74
75
  def test_dustrelay(self):
75
76
  self.log.info("Test that small outputs are acceptable when dust relay rate is set to 0 that would otherwise trigger ephemeral dust rules")
76
77
 
77
- self.restart_node(0, extra_args=["-dustrelayfee=0"])
78
+ self.restart_node(0, extra_args=[*DUST_POLICY_ARGS, "-dustrelayfee=0"])
78
79
 
79
80
  assert_equal(self.nodes[0].getrawmempool(), [])
80
81
 
@@ -95,7 +96,7 @@ class DustRelayFeeTest(BitcoinTestFramework):
95
96
  assert_equal(len(mempool_entries), 2)
96
97
 
97
98
  # Wipe extra arg to reset dust relay
98
- self.restart_node(0, extra_args=[])
99
+ self.restart_node(0, extra_args=DUST_POLICY_ARGS)
99
100
 
100
101
  assert_equal(self.nodes[0].getrawmempool(), [])
101
102
 
@@ -132,7 +133,7 @@ class DustRelayFeeTest(BitcoinTestFramework):
132
133
  else:
133
134
  dust_parameter = f"-dustrelayfee={dustfee_btc_kvb:.8f}"
134
135
  self.log.info(f"Test dust limit setting {dust_parameter} ({dustfee_sat_kvb} sat/kvB)...")
135
- self.restart_node(0, extra_args=[dust_parameter, "-permitbaremultisig"])
136
+ self.restart_node(0, extra_args=[*DUST_POLICY_ARGS, dust_parameter])
136
137
 
137
138
  for output_script, description in output_scripts:
138
139
  self.test_dust_output(self.nodes[0], dustfee_btc_kvb, output_script, description)