Various weights of transaction parts. */
| 804 | |
| 805 | /* Various weights of transaction parts. */ |
| 806 | size_t bitcoin_tx_core_weight(size_t num_inputs, size_t num_outputs) |
| 807 | { |
| 808 | size_t weight; |
| 809 | |
| 810 | /* version, input count, output count, locktime */ |
| 811 | weight = (4 + varint_size(num_inputs) + varint_size(num_outputs) + 4) |
| 812 | * 4; |
| 813 | |
| 814 | /* Add segwit fields: marker + flag */ |
| 815 | weight += 1 + 1; |
| 816 | |
| 817 | /* A couple of things need to change for elements: */ |
| 818 | if (chainparams->is_elements) { |
| 819 | /* Each transaction has surjection and rangeproof (both empty |
| 820 | * for us as long as we use unblinded L-BTC transactions). */ |
| 821 | weight += 2 * 4; |
| 822 | |
| 823 | /* An elements transaction has 1 additional output for fees */ |
| 824 | weight += bitcoin_tx_output_weight(0); |
| 825 | } |
| 826 | return weight; |
| 827 | } |
| 828 | |
| 829 | size_t bitcoin_tx_output_weight(size_t outscript_len) |
| 830 | { |
no test coverage detected