test: Format feature_fee_estimation with pep8
This commit is contained in:
parent
d759b5d26a
commit
faff85a69a
1 changed files with 10 additions and 6 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
|
||||
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):
|
||||
"""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)
|
||||
|
||||
|
||||
def split_inputs(from_node, txins, txouts, initial_split=False):
|
||||
"""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": 1, "amount": rem_change})
|
||||
|
||||
|
||||
def check_estimates(node, fees_seen):
|
||||
"""Call estimatesmartfee and verify that the estimates meet certain invariants."""
|
||||
|
||||
|
@ -189,22 +192,22 @@ class EstimateFeeTest(BitcoinTestFramework):
|
|||
split_inputs(self.nodes[0], self.nodes[0].listunspent(0), self.txouts, True)
|
||||
|
||||
# Mine
|
||||
while (len(self.nodes[0].getrawmempool()) > 0):
|
||||
while len(self.nodes[0].getrawmempool()) > 0:
|
||||
self.nodes[0].generate(1)
|
||||
|
||||
# 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
|
||||
reps = 0
|
||||
while (reps < 5):
|
||||
while reps < 5:
|
||||
# Double txouts to txouts2
|
||||
while (len(self.txouts) > 0):
|
||||
while len(self.txouts) > 0:
|
||||
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)
|
||||
# Double txouts2 to txouts
|
||||
while (len(self.txouts2) > 0):
|
||||
while len(self.txouts2) > 0:
|
||||
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)
|
||||
reps += 1
|
||||
self.log.info("Finished splitting")
|
||||
|
@ -244,5 +247,6 @@ class EstimateFeeTest(BitcoinTestFramework):
|
|||
self.log.info("Final estimates after emptying mempools")
|
||||
check_estimates(self.nodes[1], self.fees_per_kb)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
EstimateFeeTest().main()
|
||||
|
|
Loading…
Reference in a new issue