MCPcopy Create free account
hub / github.com/ElementsProject/lightning / bitcoin_tx_input_weight

Function bitcoin_tx_input_weight

bitcoin/tx.c:896–916  ·  view source on GitHub ↗

Input weight */

Source from the content-addressed store, hash-verified

894
895/* Input weight */
896size_t bitcoin_tx_input_weight(bool p2sh, size_t witness_weight)
897{
898 /* We assume < 253 witness elements */
899 size_t weight = 1 + witness_weight;
900
901 /* Input weight: txid + index + sequence */
902 weight += (32 + 4 + 4) * 4;
903
904 /* We always encode the length of the script, even if empty */
905 weight += 1 * 4;
906
907 /* P2SH variants include push of <0 <20-byte-key-hash>> */
908 if (p2sh)
909 weight += 23 * 4;
910
911 /* Elements inputs have 6 bytes of blank proofs attached. */
912 if (chainparams->is_elements)
913 weight += 6;
914
915 return weight;
916}
917
918size_t bitcoin_tx_input_witness_weight(enum utxotype utxotype)
919{

Callers 7

trim_maximum_feerateFunction · 0.85
psbt_input_get_weightFunction · 0.85
spend_anchorFunction · 0.85
utxo_spend_weightFunction · 0.85
default_lease_ratesFunction · 0.85
listfunds_successFunction · 0.85
calc_weightFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected