Skip to content

Commit b725979

Browse files
author
MarcoFalke
committed
Merge #16535: test: Explain why -whitelist is used in feature_fee_estimation
fa76285 test: Explain why -whitelist is used in feature_fee_estimation (MarcoFalke) faff85a test: Format feature_fee_estimation with pep8 (MarcoFalke) Pull request description: ACKs for top commit: practicalswift: ACK fa76285 -- diff looks correct Sjors: ACK fa76285, every bit of clarification helps. It's clear that without `-whitelist` the test becomes extremely slow (it does pass). Tree-SHA512: 13ec7e4cd0409e7bb76cbcd344e31c0f612c8ce4a1f1ec6ceaedf345f634bc09786ed38d38920c3469b2862c856ee3e5e42534ef90f531bd8dc83c3db3c06417
2 parents fbe4b76 + fa76285 commit b725979

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

test/functional/feature_fee_estimation.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
# Associated ScriptSig's to spend satisfy P2SH_1 and P2SH_2
2929
SCRIPT_SIG = [CScript([OP_TRUE, REDEEM_SCRIPT_1]), CScript([OP_TRUE, REDEEM_SCRIPT_2])]
3030

31+
3132
def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee_increment):
3233
"""Create and send a transaction with a random fee.
3334
@@ -69,6 +70,7 @@ def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee
6970

7071
return (ToHex(tx), fee)
7172

73+
7274
def split_inputs(from_node, txins, txouts, initial_split=False):
7375
"""Generate a lot of inputs so we can generate a ton of transactions.
7476
@@ -97,6 +99,7 @@ def split_inputs(from_node, txins, txouts, initial_split=False):
9799
txouts.append({"txid": txid, "vout": 0, "amount": half_change})
98100
txouts.append({"txid": txid, "vout": 1, "amount": rem_change})
99101

102+
100103
def check_estimates(node, fees_seen):
101104
"""Call estimatesmartfee and verify that the estimates meet certain invariants."""
102105

@@ -125,10 +128,11 @@ class EstimateFeeTest(BitcoinTestFramework):
125128
def set_test_params(self):
126129
self.num_nodes = 3
127130
# mine non-standard txs (e.g. txs with "dust" outputs)
131+
# Force fSendTrickle to true (via whitelist)
128132
self.extra_args = [
129-
["-acceptnonstdtxn", "-maxorphantx=1000", "-whitelist=127.0.0.1"],
130-
["-acceptnonstdtxn", "-blockmaxweight=68000", "-maxorphantx=1000"],
131-
["-acceptnonstdtxn", "-blockmaxweight=32000", "-maxorphantx=1000"],
133+
["-acceptnonstdtxn", "-whitelist=127.0.0.1"],
134+
["-acceptnonstdtxn", "-whitelist=127.0.0.1", "-blockmaxweight=68000"],
135+
["-acceptnonstdtxn", "-whitelist=127.0.0.1", "-blockmaxweight=32000"],
132136
]
133137

134138
def skip_test_if_missing_module(self):
@@ -165,9 +169,9 @@ def transact_and_mine(self, numblocks, mining_node):
165169
self.memutxo, Decimal("0.005"), min_fee, min_fee)
166170
tx_kbytes = (len(txhex) // 2) / 1000.0
167171
self.fees_per_kb.append(float(fee) / tx_kbytes)
168-
self.sync_mempools(self.nodes[0:3], wait=.1)
172+
self.sync_mempools(wait=.1)
169173
mined = mining_node.getblock(mining_node.generate(1)[0], True)["tx"]
170-
self.sync_blocks(self.nodes[0:3], wait=.1)
174+
self.sync_blocks(wait=.1)
171175
# update which txouts are confirmed
172176
newmem = []
173177
for utx in self.memutxo:
@@ -189,22 +193,22 @@ def run_test(self):
189193
split_inputs(self.nodes[0], self.nodes[0].listunspent(0), self.txouts, True)
190194

191195
# Mine
192-
while (len(self.nodes[0].getrawmempool()) > 0):
196+
while len(self.nodes[0].getrawmempool()) > 0:
193197
self.nodes[0].generate(1)
194198

195199
# Repeatedly split those 2 outputs, doubling twice for each rep
196200
# Use txouts to monitor the available utxo, since these won't be tracked in wallet
197201
reps = 0
198-
while (reps < 5):
202+
while reps < 5:
199203
# Double txouts to txouts2
200-
while (len(self.txouts) > 0):
204+
while len(self.txouts) > 0:
201205
split_inputs(self.nodes[0], self.txouts, self.txouts2)
202-
while (len(self.nodes[0].getrawmempool()) > 0):
206+
while len(self.nodes[0].getrawmempool()) > 0:
203207
self.nodes[0].generate(1)
204208
# Double txouts2 to txouts
205-
while (len(self.txouts2) > 0):
209+
while len(self.txouts2) > 0:
206210
split_inputs(self.nodes[0], self.txouts2, self.txouts)
207-
while (len(self.nodes[0].getrawmempool()) > 0):
211+
while len(self.nodes[0].getrawmempool()) > 0:
208212
self.nodes[0].generate(1)
209213
reps += 1
210214
self.log.info("Finished splitting")
@@ -244,5 +248,6 @@ def run_test(self):
244248
self.log.info("Final estimates after emptying mempools")
245249
check_estimates(self.nodes[1], self.fees_per_kb)
246250

251+
247252
if __name__ == '__main__':
248253
EstimateFeeTest().main()

test/functional/test_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
BASE_SCRIPTS = [
7777
# Scripts that are run by default.
7878
# Longest test should go first, to favor running tests in parallel
79-
'feature_fee_estimation.py',
8079
'wallet_hd.py',
8180
'wallet_backup.py',
8281
# vv Tests less than 5m vv
@@ -111,6 +110,7 @@
111110
'feature_abortnode.py',
112111
# vv Tests less than 30s vv
113112
'wallet_keypool_topup.py',
113+
'feature_fee_estimation.py',
114114
'interface_zmq.py',
115115
'interface_bitcoin_cli.py',
116116
'mempool_resurrect.py',

0 commit comments

Comments
 (0)