test: scale amounts in test_doublespend_chain down by factor 10

This is done in order to prepare the make_utxo helper to use MiniWallet,
which only supports creating transactions with single inputs, i.e. we
need to create amounts small enough to be funded by coinbase transactions
(50 BTC).
pull/826/head
Sebastian Falbesoner 3 years ago
parent 2161a05855
commit d1e2481274

@ -161,14 +161,14 @@ class ReplaceByFeeTest(BitcoinTestFramework):
def test_doublespend_chain(self): def test_doublespend_chain(self):
"""Doublespend of a long chain""" """Doublespend of a long chain"""
initial_nValue = 50 * COIN initial_nValue = 5 * COIN
tx0_outpoint = self.make_utxo(self.nodes[0], initial_nValue) tx0_outpoint = self.make_utxo(self.nodes[0], initial_nValue)
prevout = tx0_outpoint prevout = tx0_outpoint
remaining_value = initial_nValue remaining_value = initial_nValue
chain_txids = [] chain_txids = []
while remaining_value > 10 * COIN: while remaining_value > 1 * COIN:
remaining_value -= 1 * COIN remaining_value -= int(0.1 * COIN)
tx = CTransaction() tx = CTransaction()
tx.vin = [CTxIn(prevout, nSequence=0)] tx.vin = [CTxIn(prevout, nSequence=0)]
tx.vout = [CTxOut(remaining_value, CScript([1, OP_DROP] * 15 + [1]))] tx.vout = [CTxOut(remaining_value, CScript([1, OP_DROP] * 15 + [1]))]
@ -178,10 +178,10 @@ class ReplaceByFeeTest(BitcoinTestFramework):
prevout = COutPoint(int(txid, 16), 0) prevout = COutPoint(int(txid, 16), 0)
# Whether the double-spend is allowed is evaluated by including all # Whether the double-spend is allowed is evaluated by including all
# child fees - 40 BTC - so this attempt is rejected. # child fees - 4 BTC - so this attempt is rejected.
dbl_tx = CTransaction() dbl_tx = CTransaction()
dbl_tx.vin = [CTxIn(tx0_outpoint, nSequence=0)] dbl_tx.vin = [CTxIn(tx0_outpoint, nSequence=0)]
dbl_tx.vout = [CTxOut(initial_nValue - 30 * COIN, DUMMY_P2WPKH_SCRIPT)] dbl_tx.vout = [CTxOut(initial_nValue - 3 * COIN, DUMMY_P2WPKH_SCRIPT)]
dbl_tx_hex = dbl_tx.serialize().hex() dbl_tx_hex = dbl_tx.serialize().hex()
# This will raise an exception due to insufficient fee # This will raise an exception due to insufficient fee
@ -190,7 +190,7 @@ class ReplaceByFeeTest(BitcoinTestFramework):
# Accepted with sufficient fee # Accepted with sufficient fee
dbl_tx = CTransaction() dbl_tx = CTransaction()
dbl_tx.vin = [CTxIn(tx0_outpoint, nSequence=0)] dbl_tx.vin = [CTxIn(tx0_outpoint, nSequence=0)]
dbl_tx.vout = [CTxOut(1 * COIN, DUMMY_P2WPKH_SCRIPT)] dbl_tx.vout = [CTxOut(int(0.1 * COIN), DUMMY_P2WPKH_SCRIPT)]
dbl_tx_hex = dbl_tx.serialize().hex() dbl_tx_hex = dbl_tx.serialize().hex()
self.nodes[0].sendrawtransaction(dbl_tx_hex, 0) self.nodes[0].sendrawtransaction(dbl_tx_hex, 0)

Loading…
Cancel
Save