MCPcopy Create free account
hub / github.com/ElementsProject/elements / send_tx

Function send_tx

test/functional/feature_fee_estimation.py:133–143  ·  view source on GitHub ↗

Broadcast a 1in-1out transaction with a specific input and feerate (sat/vb).

(node, utxo, feerate)

Source from the content-addressed store, hash-verified

131
132
133def 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
146class EstimateFeeTest(BitcoinTestFramework):

Callers 1

Calls 8

get_vsizeMethod · 0.95
serializeMethod · 0.95
CTransactionClass · 0.90
CTxInClass · 0.90
COutPointClass · 0.90
CTxOutClass · 0.90
sendrawtransactionMethod · 0.80
hexMethod · 0.80

Tested by

no test coverage detected