Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions test/functional/feature_dbcrash.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ def verify_utxo_hash(self):
assert_equal(nodei_utxo_hash, node3_utxo_hash)

def generate_small_transactions(self, node, count, utxo_list):
FEE = 1000 # TODO: replace this with node relay fee based calculation
# Derive fee and dust threshold from the node's current relay fee rate.
relay_fee_tpc_per_kb = node.getnetworkinfo()['relayfee']
relay_fee_sat_per_byte = max(1, int(relay_fee_tpc_per_kb * COIN / 1000))
FEE = relay_fee_sat_per_byte * 1000 # flat fee: 1 kB equivalent
# Dust limit for a P2PKH output: 3 * fee_rate * (34-byte output + 148-byte spend cost)
dust_threshold = 3 * relay_fee_sat_per_byte * (34 + 148)

num_transactions = 0
random.shuffle(utxo_list)
while len(utxo_list) >= 2 and num_transactions < count:
Expand All @@ -198,8 +204,8 @@ def generate_small_transactions(self, node, count, utxo_list):
input_amount += int(utxo['amount'] * COIN)
output_amount = (input_amount - FEE) // 3

if output_amount <= 0:
# Sanity check -- if we chose inputs that are too small, skip
if output_amount < dust_threshold:
# Skip if outputs would be below dust threshold or non-positive
continue

for i in range(3):
Expand Down
2 changes: 1 addition & 1 deletion test/functional/mempool_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def run_test(self):
vout = utxo[0]['vout']
value = utxo[0]['amount']

fee = Decimal("0.0001")
fee = self.nodes[0].getnetworkinfo()['relayfee']
# MAX_ANCESTORS transactions off a confirmed tx should be fine
chain = []
for i in range(MAX_ANCESTORS):
Expand Down
2 changes: 1 addition & 1 deletion test/functional/mining_getblocktemplate_longpoll.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def run_test(self):
# generate a random transaction and submit it
min_relay_fee = self.nodes[0].getnetworkinfo()["relayfee"]
# min_relay_fee is fee per 1000 bytes, which should be more than enough.
(txid, txhex, fee) = random_transaction(self.nodes, Decimal("1.1"), min_relay_fee, Decimal("0.001"), 20)
(txid, txhex, fee) = random_transaction(self.nodes, Decimal("1.1"), min_relay_fee, min_relay_fee * 100, 20)
# after one minute, every 10 seconds the mempool is probed, so in 80 seconds it should have returned
wait_until(lambda: not thr.is_alive(), timeout=60 + 20) # wait up to 80 seconds for thread to exit
assert(not thr.is_alive())
Expand Down
3 changes: 1 addition & 2 deletions test/functional/rpc_createmultisig.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""Test transaction signing using the signrawtransaction* RPCs."""

from test_framework.test_framework import BitcoinTestFramework
import decimal

class RpcCreateMultiSigTest(BitcoinTestFramework):
def set_test_params(self):
Expand Down Expand Up @@ -83,7 +82,7 @@ def do_multisig(self):

node0.generate(1, self.signblockprivkey_wif)

outval = value - decimal.Decimal("0.00001000")
outval = value - node0.getnetworkinfo()['relayfee']
rawtx = node2.createrawtransaction([{"txid": txid, "vout": vout}], [{self.final: outval}])

rawtx2 = node2.signrawtransactionwithkey(rawtx, self.priv[0:self.nsigs-1], prevtxs, "ALL", self.options.scheme)
Expand Down
5 changes: 3 additions & 2 deletions test/functional/wallet_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,9 @@ def run_test(self):

# Send 10 TPC normal
address = self.nodes[0].getnewaddress("test")
fee_per_byte = Decimal('0.001') / 1000
self.nodes[2].settxfee(fee_per_byte * 1000)
relay_fee = self.nodes[2].getnetworkinfo()['relayfee']
fee_per_byte = relay_fee / 1000
self.nodes[2].settxfee(relay_fee)
txid = self.nodes[2].sendtoaddress(address, 10, "", "", False)
# generate block on another node so that balance is not distorted by block reward
self.sync_all([self.nodes[0:3]])
Expand Down
2 changes: 1 addition & 1 deletion test/functional/wallet_txn_doublespend.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def run_test(self):

# First: use raw transaction API to send 1240 TPC to node1_address,
# but don't broadcast:
doublespend_fee = Decimal('-.02')
doublespend_fee = -self.nodes[0].getnetworkinfo()['relayfee']
rawtx_input_0 = {}
rawtx_input_0["txid"] = fund_foo_txid
rawtx_input_0["vout"] = find_output(self.nodes[0], fund_foo_txid, 1219)
Expand Down
Loading