Skip to content

Commit d1e2481

Browse files
committed
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).
1 parent 2161a05 commit d1e2481

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/functional/feature_rbf.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,14 @@ def test_simple_doublespend(self):
161161
def test_doublespend_chain(self):
162162
"""Doublespend of a long chain"""
163163

164-
initial_nValue = 50 * COIN
164+
initial_nValue = 5 * COIN
165165
tx0_outpoint = self.make_utxo(self.nodes[0], initial_nValue)
166166

167167
prevout = tx0_outpoint
168168
remaining_value = initial_nValue
169169
chain_txids = []
170-
while remaining_value > 10 * COIN:
171-
remaining_value -= 1 * COIN
170+
while remaining_value > 1 * COIN:
171+
remaining_value -= int(0.1 * COIN)
172172
tx = CTransaction()
173173
tx.vin = [CTxIn(prevout, nSequence=0)]
174174
tx.vout = [CTxOut(remaining_value, CScript([1, OP_DROP] * 15 + [1]))]
@@ -178,10 +178,10 @@ def test_doublespend_chain(self):
178178
prevout = COutPoint(int(txid, 16), 0)
179179

180180
# Whether the double-spend is allowed is evaluated by including all
181-
# child fees - 40 BTC - so this attempt is rejected.
181+
# child fees - 4 BTC - so this attempt is rejected.
182182
dbl_tx = CTransaction()
183183
dbl_tx.vin = [CTxIn(tx0_outpoint, nSequence=0)]
184-
dbl_tx.vout = [CTxOut(initial_nValue - 30 * COIN, DUMMY_P2WPKH_SCRIPT)]
184+
dbl_tx.vout = [CTxOut(initial_nValue - 3 * COIN, DUMMY_P2WPKH_SCRIPT)]
185185
dbl_tx_hex = dbl_tx.serialize().hex()
186186

187187
# This will raise an exception due to insufficient fee
@@ -190,7 +190,7 @@ def test_doublespend_chain(self):
190190
# Accepted with sufficient fee
191191
dbl_tx = CTransaction()
192192
dbl_tx.vin = [CTxIn(tx0_outpoint, nSequence=0)]
193-
dbl_tx.vout = [CTxOut(1 * COIN, DUMMY_P2WPKH_SCRIPT)]
193+
dbl_tx.vout = [CTxOut(int(0.1 * COIN), DUMMY_P2WPKH_SCRIPT)]
194194
dbl_tx_hex = dbl_tx.serialize().hex()
195195
self.nodes[0].sendrawtransaction(dbl_tx_hex, 0)
196196

0 commit comments

Comments
 (0)