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

Function bitcoin_tx_core_weight

bitcoin/tx.c:806–827  ·  view source on GitHub ↗

Various weights of transaction parts. */

Source from the content-addressed store, hash-verified

804
805/* Various weights of transaction parts. */
806size_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
829size_t bitcoin_tx_output_weight(size_t outscript_len)
830{

Callers 6

trim_maximum_feerateFunction · 0.85
param_outputsFunction · 0.85
json_withdrawFunction · 0.85
perform_fundpsbtFunction · 0.85
start_mwFunction · 0.85
check_balancesFunction · 0.85

Calls 2

varint_sizeFunction · 0.85
bitcoin_tx_output_weightFunction · 0.85

Tested by

no test coverage detected