|
10 | 10 | from random import choice |
11 | 11 | from typing import ( |
12 | 12 | Any, |
| 13 | + List, |
13 | 14 | Optional, |
14 | 15 | ) |
15 | 16 | from test_framework.address import ( |
@@ -147,7 +148,7 @@ def get_address(self): |
147 | 148 | assert_equal(self._mode, MiniWalletMode.ADDRESS_OP_TRUE) |
148 | 149 | return self._address |
149 | 150 |
|
150 | | - def get_utxo(self, *, txid: str = '', vout: Optional[int] = None, mark_as_spent=True): |
| 151 | + def get_utxo(self, *, txid: str = '', vout: Optional[int] = None, mark_as_spent=True) -> dict: |
151 | 152 | """ |
152 | 153 | Returns a utxo and marks it as spent (pops it from the internal list) |
153 | 154 |
|
@@ -208,14 +209,21 @@ def send_self_transfer_multi(self, **kwargs): |
208 | 209 | return {'new_utxos': [self.get_utxo(txid=txid, vout=vout) for vout in range(len(tx.vout))], |
209 | 210 | 'txid': txid, 'hex': tx.serialize().hex(), 'tx': tx} |
210 | 211 |
|
211 | | - def create_self_transfer_multi(self, *, from_node, utxos_to_spend=None, num_outputs=1, fee_per_output=1000): |
| 212 | + def create_self_transfer_multi( |
| 213 | + self, *, from_node, |
| 214 | + utxos_to_spend: Optional[List[dict]] = None, |
| 215 | + num_outputs=1, |
| 216 | + sequence=0, |
| 217 | + fee_per_output=1000): |
212 | 218 | """ |
213 | 219 | Create and return a transaction that spends the given UTXOs and creates a |
214 | 220 | certain number of outputs with equal amounts. |
215 | 221 | """ |
216 | 222 | utxos_to_spend = utxos_to_spend or [self.get_utxo()] |
217 | 223 | # create simple tx template (1 input, 1 output) |
218 | | - tx = self.create_self_transfer(fee_rate=0, from_node=from_node, utxo_to_spend=utxos_to_spend[0], mempool_valid=False)['tx'] |
| 224 | + tx = self.create_self_transfer( |
| 225 | + fee_rate=0, from_node=from_node, |
| 226 | + utxo_to_spend=utxos_to_spend[0], sequence=sequence, mempool_valid=False)['tx'] |
219 | 227 |
|
220 | 228 | # duplicate inputs, witnesses and outputs |
221 | 229 | tx.vin = [deepcopy(tx.vin[0]) for _ in range(len(utxos_to_spend))] |
|
0 commit comments