Skip to content

Commit 3d632c3

Browse files
author
MarcoFalke
committed
Merge #20428: tests: shrink feature_taproot transfer of funds tx
7ffac12 tests: shrink feature_taproot transfer of funds tx (Anthony Towns) Pull request description: When moving funds from node 1 to node 0 for the pre-activation tests, there can be a large number of inputs, potentially resulting in a tx that is larger than standardness rules allow, or that takes a long time to sign. This just takes the top 500 outputs, which is plenty (~90% of the wallet balance). ACKs for top commit: luke-jr: utACK 7ffac12 MarcoFalke: cr ACK 7ffac12 Tree-SHA512: 68445b4827dddb9a8e8614d61a68f5bbd7152557bf940be0a75741cb49deeff1566198da1a777ac66cb3fed93e64a30bf895875d6cc6ae9e48275e3febb620a6
2 parents fdd0685 + 7ffac12 commit 3d632c3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/functional/feature_taproot.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -1442,17 +1442,23 @@ def run_test(self):
14421442
self.nodes[1].generate(101)
14431443
self.test_spenders(self.nodes[1], spenders_taproot_active(), input_counts=[1, 2, 2, 2, 2, 3])
14441444

1445-
# Transfer funds to pre-taproot node.
1445+
# Transfer value of the largest 500 coins to pre-taproot node.
14461446
addr = self.nodes[0].getnewaddress()
1447+
1448+
unsp = self.nodes[1].listunspent()
1449+
unsp = sorted(unsp, key=lambda i: i['amount'], reverse=True)
1450+
unsp = unsp[:500]
1451+
14471452
rawtx = self.nodes[1].createrawtransaction(
14481453
inputs=[{
14491454
'txid': i['txid'],
14501455
'vout': i['vout']
1451-
} for i in self.nodes[1].listunspent()],
1452-
outputs={addr: self.nodes[1].getbalance()},
1456+
} for i in unsp],
1457+
outputs={addr: sum(i['amount'] for i in unsp)}
14531458
)
14541459
rawtx = self.nodes[1].signrawtransactionwithwallet(rawtx)['hex']
1455-
# Transaction is too large to fit into the mempool, so put it into a block
1460+
1461+
# Mine a block with the transaction
14561462
block = create_block(tmpl=self.nodes[1].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS), txlist=[rawtx])
14571463
add_witness_commitment(block)
14581464
block.rehash()

0 commit comments

Comments
 (0)