test: simplify tests by using the pre-mined chain
This commit is contained in:
1 parent
42029a7fd4
commit
6bd098a838
5 files changed
+3
-29
No files matched your search
@@ -12,7 +12,6 @@ definable expiry timeout via the '-mempoolexpiry=<n>' command line argument
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from test_framework.blocktools import COINBASE_MATURITY
|
||||
from test_framework.messages import DEFAULT_MEMPOOL_EXPIRY_HOURS
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
@@ -27,17 +26,11 @@ CUSTOM_MEMPOOL_EXPIRY = 10 # hours
|
||||
class MempoolExpiryTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
self.setup_clean_chain = True
|
||||
|
||||
def test_transaction_expiry(self, timeout):
|
||||
"""Tests that a transaction expires after the expiry timeout and its
|
||||
children are removed as well."""
|
||||
node = self.nodes[0]
|
||||
self.wallet = MiniWallet(node)
|
||||
|
||||
# Add enough mature utxos to the wallet so that all txs spend confirmed coins.
|
||||
self.generate(self.wallet, 4)
|
||||
self.generate(node, COINBASE_MATURITY)
|
||||
|
||||
# Send a parent transaction that will expire.
|
||||
parent_txid = self.wallet.send_self_transfer(from_node=node)['txid']
|
||||
@@ -97,6 +90,8 @@ class MempoolExpiryTest(BitcoinTestFramework):
|
||||
assert_equal(half_expiry_time, node.getmempoolentry(independent_txid)['time'])
|
||||
|
||||
def run_test(self):
|
||||
self.wallet = MiniWallet(self.nodes[0])
|
||||
|
||||
self.log.info('Test default mempool expiry timeout of %d hours.' %
|
||||
DEFAULT_MEMPOOL_EXPIRY_HOURS)
|
||||
self.test_transaction_expiry(DEFAULT_MEMPOOL_EXPIRY_HOURS)
|
||||
|
||||
Reference in new issue
Block a user