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.
This commit is contained in:
Andreas Kouloumos
2022-06-28 14:23:45 +03:00
parent 1d6b438ef0
commit f2f6068b69
2 changed files with 35 additions and 45 deletions

View File

@ -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