aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/smartfees.py
diff options
context:
space:
mode:
Diffstat (limited to 'qa/rpc-tests/smartfees.py')
-rwxr-xr-xqa/rpc-tests/smartfees.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/qa/rpc-tests/smartfees.py b/qa/rpc-tests/smartfees.py
index 2c56f954a2..bde454968f 100755
--- a/qa/rpc-tests/smartfees.py
+++ b/qa/rpc-tests/smartfees.py
@@ -2,10 +2,7 @@
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#
-# Test fee estimation code
-#
+"""Test fee estimation code."""
from collections import OrderedDict
from test_framework.test_framework import BitcoinTestFramework
@@ -21,7 +18,7 @@ P2SH_2 = "2NBdpwq8Aoo1EEKEXPNrKvr5xQr3M9UfcZA" # P2SH of "OP_2 OP_DROP"
SCRIPT_SIG = ["0451025175", "0451025275"]
def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee_increment):
- '''
+ """
Create and send a transaction with a random fee.
The transaction pays to a trivial P2SH script, and assumes that its inputs
are of the same form.
@@ -29,7 +26,7 @@ def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee
and attempts to use the confirmed list first for its inputs.
It adds the newly created outputs to the unconfirmed list.
Returns (raw transaction, fee)
- '''
+ """
# It's best to exponentially distribute our random fees
# because the buckets are exponentially spaced.
# Exponentially distributed from 1-128 * fee_increment
@@ -71,12 +68,12 @@ def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee
return (completetx, fee)
def split_inputs(from_node, txins, txouts, initial_split = False):
- '''
+ """
We need to generate a lot of very small inputs so we can generate a ton of transactions
and they will have low priority.
This function takes an input from txins, and creates and sends a transaction
which splits the value into 2 outputs which are appended to txouts.
- '''
+ """
prevtxout = txins.pop()
inputs = []
inputs.append({ "txid" : prevtxout["txid"], "vout" : prevtxout["vout"] })
@@ -95,10 +92,10 @@ def split_inputs(from_node, txins, txouts, initial_split = False):
txouts.append({ "txid" : txid, "vout" : 1 , "amount" : rem_change})
def check_estimates(node, fees_seen, max_invalid, print_estimates = True):
- '''
+ """
This function calls estimatefee and verifies that the estimates
meet certain invariants.
- '''
+ """
all_estimates = [ node.estimatefee(i) for i in range(1,26) ]
if print_estimates:
print([str(all_estimates[e-1]) for e in [1,2,3,6,15,25]])
@@ -151,11 +148,11 @@ class EstimateFeeTest(BitcoinTestFramework):
self.setup_clean_chain = False
def setup_network(self):
- '''
+ """
We'll setup the network to have 3 nodes that all mine with different parameters.
But first we need to use one node to create a lot of small low priority outputs
which we will use to generate our transactions.
- '''
+ """
self.nodes = []
# Use node0 to mine blocks for input splitting
self.nodes.append(start_node(0, self.options.tmpdir, ["-maxorphantx=1000",