scripted-diff: test: rename MAX_{ANCESTORS,DESCENDANTS} to DEFAULT_{ANCESTOR,DESCENDANT}_LIMIT

-BEGIN VERIFY SCRIPT-
ren() { sed -i "s:$1:$2:g" $(git grep -l "$1" ./test); }

ren MAX_ANCESTORS_CUSTOM    CUSTOM_ANCESTOR_LIMIT
ren MAX_DESCENDANTS_CUSTOM  CUSTOM_DESCENDANT_LIMIT
ren MAX_ANCESTORS           DEFAULT_ANCESTOR_LIMIT
ren MAX_DESCENDANTS         DEFAULT_DESCENDANT_LIMIT
-END VERIFY SCRIPT-
This commit is contained in:
Sebastian Falbesoner
2022-08-09 14:44:26 +02:00
parent c012875b9d
commit 0fda1c7df6
2 changed files with 26 additions and 26 deletions

View File

@@ -15,8 +15,8 @@ from test_framework.util import (
from test_framework.wallet import MiniWallet
MAX_ANCESTORS = 25
MAX_DESCENDANTS = 25
DEFAULT_ANCESTOR_LIMIT = 25
DEFAULT_DESCENDANT_LIMIT = 25
class MempoolPackagesTest(BitcoinTestFramework):
@@ -34,19 +34,19 @@ class MempoolPackagesTest(BitcoinTestFramework):
self.wallet = MiniWallet(self.nodes[0])
self.wallet.rescan_utxos()
# MAX_ANCESTORS transactions off a confirmed tx should be fine
# DEFAULT_ANCESTOR_LIMIT transactions off a confirmed tx should be fine
chain = []
utxo = self.wallet.get_utxo()
for _ in range(4):
utxo, utxo2 = self.chain_tx([utxo], num_outputs=2)
chain.append(utxo2)
for _ in range(MAX_ANCESTORS - 4):
for _ in range(DEFAULT_ANCESTOR_LIMIT - 4):
utxo, = self.chain_tx([utxo])
chain.append(utxo)
second_chain, = self.chain_tx([self.wallet.get_utxo()])
# Check mempool has MAX_ANCESTORS + 1 transactions in it
assert_equal(len(self.nodes[0].getrawmempool()), MAX_ANCESTORS + 1)
# Check mempool has DEFAULT_ANCESTOR_LIMIT + 1 transactions in it
assert_equal(len(self.nodes[0].getrawmempool()), DEFAULT_ANCESTOR_LIMIT + 1)
# Adding one more transaction on to the chain should fail.
assert_raises_rpc_error(-26, "too-long-mempool-chain, too many unconfirmed ancestors [limit: 25]", self.chain_tx, [utxo])
@@ -67,7 +67,7 @@ class MempoolPackagesTest(BitcoinTestFramework):
self.nodes[0].sendrawtransaction(replacable_tx.serialize().hex())
# Finally, check that we added two transactions
assert_equal(len(self.nodes[0].getrawmempool()), MAX_ANCESTORS + 3)
assert_equal(len(self.nodes[0].getrawmempool()), DEFAULT_ANCESTOR_LIMIT + 3)
if __name__ == '__main__':