Various weights of transaction parts. */
| 847 | |
| 848 | /* Various weights of transaction parts. */ |
| 849 | size_t bitcoin_tx_core_weight(size_t num_inputs, size_t num_outputs) |
| 850 | { |
| 851 | size_t weight; |
| 852 | |
| 853 | /* version, input count, output count, locktime */ |
| 854 | weight = (4 + varint_size(num_inputs) + varint_size(num_outputs) + 4) |
| 855 | * 4; |
| 856 | |
| 857 | /* Add segwit fields: marker + flag */ |
| 858 | weight += 1 + 1; |
| 859 | |
| 860 | /* A couple of things need to change for elements: */ |
| 861 | if (chainparams->is_elements) { |
| 862 | /* Each transaction has surjection and rangeproof (both empty |
| 863 | * for us as long as we use unblinded L-BTC transactions). */ |
| 864 | weight += 2 * 4; |
| 865 | |
| 866 | /* An elements transaction has 1 additional output for fees */ |
| 867 | weight += bitcoin_tx_output_weight(0); |
| 868 | } |
| 869 | return weight; |
| 870 | } |
| 871 | |
| 872 | size_t bitcoin_tx_output_weight(size_t outscript_len) |
| 873 | { |
no test coverage detected