v31.1-roots.1 · Commit 4: [PATCH 04/17] feat(mining): preserve Roots priority and template policies
test/functional/mempool_subdust_fee_penalty.py
Before: test/functional/mempool_subdust_fee_penalty.py · After: test/functional/mempool_subdust_fee_penalty.py
File metadata
index 5af44872f9dab968de0ab3874808c16275bff870..3f903e58d575c359a964c94a39b88132e3ed294c 100644
Download original patch · Release notes
Diff rows 1–33 of 33. 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_subdust_fee_penalty.py
CHANGED
|
@@ -326,7 +326,7 @@ class SubDustFeePenaltyTest(BitcoinTestFramework):
|
|
| 326 |
def test_mining_and_block_acceptance(self):
|
| 327 |
self.log.info("Templates select modified fees, while blocks reward actual fees and accept local rejects")
|
| 328 |
node = self.nodes[0]
|
| 329 |
-
self.reset_policy("-blockmintxfee=0.00002")
|
| 330 |
probe = self.build_tx_with_dust([0], 1000)
|
| 331 |
min_fee = self.get_min_relay_fee(probe)
|
| 332 |
low = self.build_tx_with_dust([0], min_fee)
|
|
@@ -353,12 +353,22 @@ class SubDustFeePenaltyTest(BitcoinTestFramework):
|
|
| 353 |
assert txid in [entry["txid"] for entry in mined["tx"]]
|
| 354 |
# Regtest at this height has a 25 BTC subsidy. Penalty/delta do not alter reward.
|
| 355 |
assert_equal(sum(output["value"] for output in mined["tx"][0]["vout"]), Decimal(25) + Decimal(fee) / COIN)
|
| 356 |
-
self.reset_policy("-blockmintxfee=0.00002", "-subdustfeepenalty=0")
|
| 357 |
tx = self.build_tx_with_dust([0], fee)
|
| 358 |
txid = node.sendrawtransaction(tx.serialize().hex())
|
| 359 |
assert txid in [entry["txid"] for entry in node.getblocktemplate({"rules": ["segwit"]})["transactions"]]
|
| 360 |
-
# Priority-area selection is verified with its native L9 implementation.
|
| 361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 362 |
|
| 363 |
|
| 364 |
if __name__ == '__main__':
|
|
|
|
| 326 |
def test_mining_and_block_acceptance(self):
|
| 327 |
self.log.info("Templates select modified fees, while blocks reward actual fees and accept local rejects")
|
| 328 |
node = self.nodes[0]
|
| 329 |
+
self.reset_policy("-blockprioritysize=0", "-blockmintxfee=0.00002")
|
| 330 |
probe = self.build_tx_with_dust([0], 1000)
|
| 331 |
min_fee = self.get_min_relay_fee(probe)
|
| 332 |
low = self.build_tx_with_dust([0], min_fee)
|
|
|
|
| 353 |
assert txid in [entry["txid"] for entry in mined["tx"]]
|
| 354 |
# Regtest at this height has a 25 BTC subsidy. Penalty/delta do not alter reward.
|
| 355 |
assert_equal(sum(output["value"] for output in mined["tx"][0]["vout"]), Decimal(25) + Decimal(fee) / COIN)
|
| 356 |
+
self.reset_policy("-blockprioritysize=0", "-blockmintxfee=0.00002", "-subdustfeepenalty=0")
|
| 357 |
tx = self.build_tx_with_dust([0], fee)
|
| 358 |
txid = node.sendrawtransaction(tx.serialize().hex())
|
| 359 |
assert txid in [entry["txid"] for entry in node.getblocktemplate({"rules": ["segwit"]})["transactions"]]
|
| 360 |
+
self.reset_policy("-blockprioritysize=100000", "-blockmintxfee=0.00002")
|
| 361 |
+
# The explicit priority area can mine sufficiently aged coins below the
|
| 362 |
+
# template's fee floor. The dust penalty still appears in entry accounting.
|
| 363 |
+
tx = self.build_tx_with_dust([0], DUST_THRESHOLD + min_fee)
|
| 364 |
+
txid = node.sendrawtransaction(tx.serialize().hex())
|
| 365 |
+
assert_equal(node.getmempoolentry(txid)["fees"]["modified"], Decimal(min_fee) / COIN)
|
| 366 |
+
assert txid in [entry["txid"] for entry in node.getblocktemplate({"rules": ["segwit"]})["transactions"]]
|
| 367 |
+
self.generate(self.wallet, 1)
|
| 368 |
+
mined = node.getblock(node.getbestblockhash(), 2)
|
| 369 |
+
assert_equal([entry["txid"] for entry in mined["tx"]][1:], [txid])
|
| 370 |
+
assert_equal(sum(output["value"] for output in mined["tx"][0]["vout"]),
|
| 371 |
+
Decimal(25) + Decimal(DUST_THRESHOLD + min_fee) / COIN)
|
| 372 |
|
| 373 |
|
| 374 |
if __name__ == '__main__':
|