Input weight */
| 894 | |
| 895 | /* Input weight */ |
| 896 | size_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 | |
| 918 | size_t bitcoin_tx_input_witness_weight(enum utxotype utxotype) |
| 919 | { |
no outgoing calls
no test coverage detected