Broadcast a 1in-1out transaction with a specific input and feerate (sat/vb).
(node, utxo, feerate)
| 131 | |
| 132 | |
| 133 | def send_tx(node, utxo, feerate): |
| 134 | """Broadcast a 1in-1out transaction with a specific input and feerate (sat/vb).""" |
| 135 | tx = CTransaction() |
| 136 | tx.vin = [CTxIn(COutPoint(int(utxo["txid"], 16), utxo["vout"]), REDEEM_SCRIPT)] |
| 137 | tx.vout = [CTxOut(int(utxo["amount"] * COIN), P2SH)] |
| 138 | |
| 139 | # vbytes == bytes as we are using legacy transactions |
| 140 | fee = tx.get_vsize() * feerate |
| 141 | tx.vout[0].nValue -= fee |
| 142 | |
| 143 | return node.sendrawtransaction(tx.serialize().hex()) |
| 144 | |
| 145 | |
| 146 | class EstimateFeeTest(BitcoinTestFramework): |
no test coverage detected