| 584 | |
| 585 | |
| 586 | def spend_one_input(node, dest_address, change_size=Decimal("0.00049000")): |
| 587 | tx_input = dict( |
| 588 | sequence=BIP125_SEQUENCE_NUMBER, **next(u for u in node.listunspent() if u["amount"] == Decimal("0.00100000"))) |
| 589 | destinations = [{dest_address: Decimal("0.00050000")}] |
| 590 | if change_size > 0: |
| 591 | destinations.append({node.getrawchangeaddress(): change_size}) |
| 592 | destinations.append({"fee": Decimal("0.00001")}) |
| 593 | rawtx = node.createrawtransaction([tx_input], destinations) |
| 594 | signedtx = node.signrawtransactionwithwallet(rawtx) |
| 595 | txid = node.sendrawtransaction(signedtx["hex"]) |
| 596 | return txid |
| 597 | |
| 598 | |
| 599 | def submit_block_with_tx(node, tx): |