|
23 | 23 |
|
24 | 24 | LOGGER = logging.getLogger(__name__) |
25 | 25 |
|
26 | | - |
27 | 26 | TxInputGroup = list[tuple[list[clusterlib.UTXOData], pl.Path]] |
28 | 27 |
|
29 | 28 |
|
@@ -190,7 +189,9 @@ def dedup_tx_inputs(tx_inputs: TxInputGroup) -> TxInputGroup: |
190 | 189 | return unique_inputs |
191 | 190 |
|
192 | 191 |
|
193 | | -def batch_tx_inputs(tx_inputs: TxInputGroup, batch_size: int = 100) -> tp.Iterator[TxInputGroup]: |
| 192 | +def batch_tx_inputs( |
| 193 | + tx_inputs: TxInputGroup, batch_size: int = 100 |
| 194 | +) -> tp.Generator[TxInputGroup, None, None]: |
194 | 195 | """Batch transaction inputs.""" |
195 | 196 | current_batch: TxInputGroup = [] |
196 | 197 | current_utxo_count = 0 |
@@ -240,6 +241,8 @@ def return_funds_to_faucet( |
240 | 241 | # The amount of "-1" means all available funds. |
241 | 242 | fund_dst = [clusterlib.TxOut(address=faucet_address, amount=-1)] |
242 | 243 |
|
| 244 | + # Tx inputs deduplication is not strictly needed, as we are deduplicating the |
| 245 | + # address files. Keeping it here for separation of concerns. |
243 | 246 | for batch in batch_tx_inputs(tx_inputs=dedup_tx_inputs(tx_inputs=tx_inputs)): |
244 | 247 | txins, skeys = flatten_tx_inputs(tx_inputs=batch) |
245 | 248 | fund_tx_files = clusterlib.TxFiles(signing_key_files=skeys) |
@@ -400,7 +403,7 @@ def _run(files: list[pl.Path], f_addr: clusterlib.AddressRecord) -> TxInputGroup |
400 | 403 | def cleanup_certs( |
401 | 404 | cluster_obj: clusterlib.ClusterLib, location: pl.Path, faucet_payment: clusterlib.AddressRecord |
402 | 405 | ) -> None: |
403 | | - """Cleanup DRep certs.""" |
| 406 | + """Cleanup certificates.""" |
404 | 407 | files_found = list(find_cert_files(location)) |
405 | 408 | num_threads = min(10, (len(files_found) // 10) + 1) |
406 | 409 | file_chunks = [files_found[i::num_threads] for i in range(num_threads)] |
@@ -461,6 +464,11 @@ def _get_faucet_payment_rec( |
461 | 464 | address: str = "", |
462 | 465 | skey_file: clusterlib.FileType = "", |
463 | 466 | ) -> clusterlib.AddressRecord: |
| 467 | + """Get the faucet payment record. |
| 468 | +
|
| 469 | + If address or skey_file is provided, use them to create the record. |
| 470 | + Otherwise, infer the faucet address and keys from the cluster environment. |
| 471 | + """ |
464 | 472 | if address or skey_file: |
465 | 473 | if not (address and skey_file): |
466 | 474 | err = "Both 'address' and 'skey_file' need to be set." |
|
0 commit comments