mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 01:42:58 +01:00
functional test: Add new -dustrelayfee=0 test case
This test would catch regressions where ephemeral dust checks are being erroneously applied on outputs that are not actually dust.
This commit is contained in:
parent
2b33322169
commit
04b2714fbb
@ -71,9 +71,39 @@ class DustRelayFeeTest(BitcoinTestFramework):
|
||||
# finally send the transaction to avoid running out of MiniWallet UTXOs
|
||||
self.wallet.sendrawtransaction(from_node=node, tx_hex=tx_good_hex)
|
||||
|
||||
def test_dustrelay(self):
|
||||
self.log.info("Test that small outputs are acceptable when dust relay rate is set to 0 that would otherwise trigger ephemeral dust rules")
|
||||
|
||||
self.restart_node(0, extra_args=["-dustrelayfee=0"])
|
||||
|
||||
assert_equal(self.nodes[0].getrawmempool(), [])
|
||||
|
||||
# Double dust, both unspent, with fees. Would have failed individual checks.
|
||||
# Dust is 1 satoshi create_self_transfer_multi disallows 0
|
||||
dusty_tx = self.wallet.create_self_transfer_multi(fee_per_output=1000, amount_per_output=1, num_outputs=2)
|
||||
dust_txid = self.nodes[0].sendrawtransaction(hexstring=dusty_tx["hex"], maxfeerate=0)
|
||||
|
||||
assert_equal(self.nodes[0].getrawmempool(), [dust_txid])
|
||||
|
||||
# Spends one dust along with fee input, leave other dust unspent to check ephemeral dust checks aren't being enforced
|
||||
sweep_tx = self.wallet.create_self_transfer_multi(utxos_to_spend=[self.wallet.get_utxo(), dusty_tx["new_utxos"][0]])
|
||||
sweep_txid = self.nodes[0].sendrawtransaction(sweep_tx["hex"])
|
||||
|
||||
mempool_entries = self.nodes[0].getrawmempool()
|
||||
assert dust_txid in mempool_entries
|
||||
assert sweep_txid in mempool_entries
|
||||
assert_equal(len(mempool_entries), 2)
|
||||
|
||||
# Wipe extra arg to reset dust relay
|
||||
self.restart_node(0, extra_args=[])
|
||||
|
||||
assert_equal(self.nodes[0].getrawmempool(), [])
|
||||
|
||||
def run_test(self):
|
||||
self.wallet = MiniWallet(self.nodes[0])
|
||||
|
||||
self.test_dustrelay()
|
||||
|
||||
# prepare output scripts of each standard type
|
||||
_, uncompressed_pubkey = generate_keypair(compressed=False)
|
||||
_, pubkey = generate_keypair(compressed=True)
|
||||
|
Loading…
Reference in New Issue
Block a user