mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
Merge #16535: test: Explain why -whitelist is used in feature_fee_estimation
fa76285fdd
test: Explain why -whitelist is used in feature_fee_estimation (MarcoFalke)faff85a69a
test: Format feature_fee_estimation with pep8 (MarcoFalke) Pull request description: ACKs for top commit: practicalswift: ACKfa76285fdd
-- diff looks correct Sjors: ACKfa76285
, every bit of clarification helps. It's clear that without `-whitelist` the test becomes extremely slow (it does pass). Tree-SHA512: 13ec7e4cd0409e7bb76cbcd344e31c0f612c8ce4a1f1ec6ceaedf345f634bc09786ed38d38920c3469b2862c856ee3e5e42534ef90f531bd8dc83c3db3c06417
This commit is contained in:
commit
b725979a11
2 changed files with 17 additions and 12 deletions
|
@ -28,6 +28,7 @@ P2SH_2 = CScript([OP_HASH160, hash160(REDEEM_SCRIPT_2), OP_EQUAL])
|
||||||
# Associated ScriptSig's to spend satisfy P2SH_1 and P2SH_2
|
# Associated ScriptSig's to spend satisfy P2SH_1 and P2SH_2
|
||||||
SCRIPT_SIG = [CScript([OP_TRUE, REDEEM_SCRIPT_1]), CScript([OP_TRUE, REDEEM_SCRIPT_2])]
|
SCRIPT_SIG = [CScript([OP_TRUE, REDEEM_SCRIPT_1]), CScript([OP_TRUE, REDEEM_SCRIPT_2])]
|
||||||
|
|
||||||
|
|
||||||
def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee_increment):
|
def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee_increment):
|
||||||
"""Create and send a transaction with a random fee.
|
"""Create and send a transaction with a random fee.
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee
|
||||||
|
|
||||||
return (ToHex(tx), fee)
|
return (ToHex(tx), fee)
|
||||||
|
|
||||||
|
|
||||||
def split_inputs(from_node, txins, txouts, initial_split=False):
|
def split_inputs(from_node, txins, txouts, initial_split=False):
|
||||||
"""Generate a lot of inputs so we can generate a ton of transactions.
|
"""Generate a lot of inputs so we can generate a ton of transactions.
|
||||||
|
|
||||||
|
@ -97,6 +99,7 @@ def split_inputs(from_node, txins, txouts, initial_split=False):
|
||||||
txouts.append({"txid": txid, "vout": 0, "amount": half_change})
|
txouts.append({"txid": txid, "vout": 0, "amount": half_change})
|
||||||
txouts.append({"txid": txid, "vout": 1, "amount": rem_change})
|
txouts.append({"txid": txid, "vout": 1, "amount": rem_change})
|
||||||
|
|
||||||
|
|
||||||
def check_estimates(node, fees_seen):
|
def check_estimates(node, fees_seen):
|
||||||
"""Call estimatesmartfee and verify that the estimates meet certain invariants."""
|
"""Call estimatesmartfee and verify that the estimates meet certain invariants."""
|
||||||
|
|
||||||
|
@ -125,10 +128,11 @@ class EstimateFeeTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
# mine non-standard txs (e.g. txs with "dust" outputs)
|
# mine non-standard txs (e.g. txs with "dust" outputs)
|
||||||
|
# Force fSendTrickle to true (via whitelist)
|
||||||
self.extra_args = [
|
self.extra_args = [
|
||||||
["-acceptnonstdtxn", "-maxorphantx=1000", "-whitelist=127.0.0.1"],
|
["-acceptnonstdtxn", "-whitelist=127.0.0.1"],
|
||||||
["-acceptnonstdtxn", "-blockmaxweight=68000", "-maxorphantx=1000"],
|
["-acceptnonstdtxn", "-whitelist=127.0.0.1", "-blockmaxweight=68000"],
|
||||||
["-acceptnonstdtxn", "-blockmaxweight=32000", "-maxorphantx=1000"],
|
["-acceptnonstdtxn", "-whitelist=127.0.0.1", "-blockmaxweight=32000"],
|
||||||
]
|
]
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
|
@ -165,9 +169,9 @@ class EstimateFeeTest(BitcoinTestFramework):
|
||||||
self.memutxo, Decimal("0.005"), min_fee, min_fee)
|
self.memutxo, Decimal("0.005"), min_fee, min_fee)
|
||||||
tx_kbytes = (len(txhex) // 2) / 1000.0
|
tx_kbytes = (len(txhex) // 2) / 1000.0
|
||||||
self.fees_per_kb.append(float(fee) / tx_kbytes)
|
self.fees_per_kb.append(float(fee) / tx_kbytes)
|
||||||
self.sync_mempools(self.nodes[0:3], wait=.1)
|
self.sync_mempools(wait=.1)
|
||||||
mined = mining_node.getblock(mining_node.generate(1)[0], True)["tx"]
|
mined = mining_node.getblock(mining_node.generate(1)[0], True)["tx"]
|
||||||
self.sync_blocks(self.nodes[0:3], wait=.1)
|
self.sync_blocks(wait=.1)
|
||||||
# update which txouts are confirmed
|
# update which txouts are confirmed
|
||||||
newmem = []
|
newmem = []
|
||||||
for utx in self.memutxo:
|
for utx in self.memutxo:
|
||||||
|
@ -189,22 +193,22 @@ class EstimateFeeTest(BitcoinTestFramework):
|
||||||
split_inputs(self.nodes[0], self.nodes[0].listunspent(0), self.txouts, True)
|
split_inputs(self.nodes[0], self.nodes[0].listunspent(0), self.txouts, True)
|
||||||
|
|
||||||
# Mine
|
# Mine
|
||||||
while (len(self.nodes[0].getrawmempool()) > 0):
|
while len(self.nodes[0].getrawmempool()) > 0:
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
|
|
||||||
# Repeatedly split those 2 outputs, doubling twice for each rep
|
# Repeatedly split those 2 outputs, doubling twice for each rep
|
||||||
# Use txouts to monitor the available utxo, since these won't be tracked in wallet
|
# Use txouts to monitor the available utxo, since these won't be tracked in wallet
|
||||||
reps = 0
|
reps = 0
|
||||||
while (reps < 5):
|
while reps < 5:
|
||||||
# Double txouts to txouts2
|
# Double txouts to txouts2
|
||||||
while (len(self.txouts) > 0):
|
while len(self.txouts) > 0:
|
||||||
split_inputs(self.nodes[0], self.txouts, self.txouts2)
|
split_inputs(self.nodes[0], self.txouts, self.txouts2)
|
||||||
while (len(self.nodes[0].getrawmempool()) > 0):
|
while len(self.nodes[0].getrawmempool()) > 0:
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
# Double txouts2 to txouts
|
# Double txouts2 to txouts
|
||||||
while (len(self.txouts2) > 0):
|
while len(self.txouts2) > 0:
|
||||||
split_inputs(self.nodes[0], self.txouts2, self.txouts)
|
split_inputs(self.nodes[0], self.txouts2, self.txouts)
|
||||||
while (len(self.nodes[0].getrawmempool()) > 0):
|
while len(self.nodes[0].getrawmempool()) > 0:
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
reps += 1
|
reps += 1
|
||||||
self.log.info("Finished splitting")
|
self.log.info("Finished splitting")
|
||||||
|
@ -244,5 +248,6 @@ class EstimateFeeTest(BitcoinTestFramework):
|
||||||
self.log.info("Final estimates after emptying mempools")
|
self.log.info("Final estimates after emptying mempools")
|
||||||
check_estimates(self.nodes[1], self.fees_per_kb)
|
check_estimates(self.nodes[1], self.fees_per_kb)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
EstimateFeeTest().main()
|
EstimateFeeTest().main()
|
||||||
|
|
|
@ -76,7 +76,6 @@ EXTENDED_SCRIPTS = [
|
||||||
BASE_SCRIPTS = [
|
BASE_SCRIPTS = [
|
||||||
# Scripts that are run by default.
|
# Scripts that are run by default.
|
||||||
# Longest test should go first, to favor running tests in parallel
|
# Longest test should go first, to favor running tests in parallel
|
||||||
'feature_fee_estimation.py',
|
|
||||||
'wallet_hd.py',
|
'wallet_hd.py',
|
||||||
'wallet_backup.py',
|
'wallet_backup.py',
|
||||||
# vv Tests less than 5m vv
|
# vv Tests less than 5m vv
|
||||||
|
@ -111,6 +110,7 @@ BASE_SCRIPTS = [
|
||||||
'feature_abortnode.py',
|
'feature_abortnode.py',
|
||||||
# vv Tests less than 30s vv
|
# vv Tests less than 30s vv
|
||||||
'wallet_keypool_topup.py',
|
'wallet_keypool_topup.py',
|
||||||
|
'feature_fee_estimation.py',
|
||||||
'interface_zmq.py',
|
'interface_zmq.py',
|
||||||
'interface_bitcoin_cli.py',
|
'interface_bitcoin_cli.py',
|
||||||
'mempool_resurrect.py',
|
'mempool_resurrect.py',
|
||||||
|
|
Loading…
Add table
Reference in a new issue