aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorAndreas Kouloumos <kouloumosa@gmail.com>2022-06-28 14:23:45 +0300
committerAndreas Kouloumos <kouloumosa@gmail.com>2022-08-01 19:11:36 +0300
commitf2f6068b69b1b532db92b276f024c89b56f38294 (patch)
treed094944d6d52f3223c902701b1e667d200b738ce /test/functional/test_framework
parent1d6b438ef0ccd05e1522ac38b44f847c1d93e72f (diff)
downloadbitcoin-f2f6068b69b1b532db92b276f024c89b56f38294.tar.xz
test: MiniWallet: add `send_self_transfer_chain` to create chain of txns
With this new method, a chain of transactions can be created. This method is introduced to further simplify the mempool_package_limits.py tests.
Diffstat (limited to 'test/functional/test_framework')
-rw-r--r--test/functional/test_framework/wallet.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/functional/test_framework/wallet.py b/test/functional/test_framework/wallet.py
index a04e8525c1..b671ecbaf2 100644
--- a/test/functional/test_framework/wallet.py
+++ b/test/functional/test_framework/wallet.py
@@ -335,6 +335,18 @@ class MiniWallet:
self.scan_tx(from_node.decoderawtransaction(tx_hex))
return txid
+ def send_self_transfer_chain(self, *, from_node, chain_length, utxo_to_spend=None):
+ """Create and send a "chain" of chain_length transactions. The nth transaction in
+ the chain is a child of the n-1th transaction and parent of the n+1th transaction.
+
+ Returns the chaintip (nth) utxo
+ """
+ chaintip_utxo = utxo_to_spend or self.get_utxo()
+ for _ in range(chain_length):
+ chaintip_utxo = self.send_self_transfer(utxo_to_spend=chaintip_utxo, from_node=from_node)["new_utxo"]
+ return chaintip_utxo
+
+
def getnewdestination(address_type='bech32m'):
"""Generate a random destination of the specified type and return the
corresponding public key, scriptPubKey and address. Supported types are