Skip to content

Commit 0f27524

Browse files
committed
test: scale amounts in test_doublespend_tree 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 d1e2481 commit 0f27524

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
@@ -201,10 +201,10 @@ def test_doublespend_chain(self):
201201
def test_doublespend_tree(self):
202202
"""Doublespend of a big tree of transactions"""
203203

204-
initial_nValue = 50 * COIN
204+
initial_nValue = 5 * COIN
205205
tx0_outpoint = self.make_utxo(self.nodes[0], initial_nValue)
206206

207-
def branch(prevout, initial_value, max_txs, tree_width=5, fee=0.0001 * COIN, _total_txs=None):
207+
def branch(prevout, initial_value, max_txs, tree_width=5, fee=0.00001 * COIN, _total_txs=None):
208208
if _total_txs is None:
209209
_total_txs = [0]
210210
if _total_txs[0] >= max_txs:
@@ -235,7 +235,7 @@ def branch(prevout, initial_value, max_txs, tree_width=5, fee=0.0001 * COIN, _to
235235
_total_txs=_total_txs):
236236
yield x
237237

238-
fee = int(0.0001 * COIN)
238+
fee = int(0.00001 * COIN)
239239
n = MAX_REPLACEMENT_LIMIT
240240
tree_txs = list(branch(tx0_outpoint, initial_nValue, n, fee=fee))
241241
assert_equal(len(tree_txs), n)
@@ -248,10 +248,10 @@ def branch(prevout, initial_value, max_txs, tree_width=5, fee=0.0001 * COIN, _to
248248
# This will raise an exception due to insufficient fee
249249
assert_raises_rpc_error(-26, "insufficient fee", self.nodes[0].sendrawtransaction, dbl_tx_hex, 0)
250250

251-
# 1 BTC fee is enough
251+
# 0.1 BTC fee is enough
252252
dbl_tx = CTransaction()
253253
dbl_tx.vin = [CTxIn(tx0_outpoint, nSequence=0)]
254-
dbl_tx.vout = [CTxOut(initial_nValue - fee * n - 1 * COIN, DUMMY_P2WPKH_SCRIPT)]
254+
dbl_tx.vout = [CTxOut(initial_nValue - fee * n - int(0.1 * COIN), DUMMY_P2WPKH_SCRIPT)]
255255
dbl_tx_hex = dbl_tx.serialize().hex()
256256
self.nodes[0].sendrawtransaction(dbl_tx_hex, 0)
257257

@@ -264,7 +264,7 @@ def branch(prevout, initial_value, max_txs, tree_width=5, fee=0.0001 * COIN, _to
264264
# Try again, but with more total transactions than the "max txs
265265
# double-spent at once" anti-DoS limit.
266266
for n in (MAX_REPLACEMENT_LIMIT + 1, MAX_REPLACEMENT_LIMIT * 2):
267-
fee = int(0.0001 * COIN)
267+
fee = int(0.00001 * COIN)
268268
tx0_outpoint = self.make_utxo(self.nodes[0], initial_nValue)
269269
tree_txs = list(branch(tx0_outpoint, initial_nValue, n, fee=fee))
270270
assert_equal(len(tree_txs), n)

0 commit comments

Comments
 (0)