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

Function bitcoin_tx_core_weight

bitcoin/tx.c:849–870  ·  view source on GitHub ↗

Various weights of transaction parts. */

Source from the content-addressed store, hash-verified

847
848/* Various weights of transaction parts. */
849size_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
872size_t bitcoin_tx_output_weight(size_t outscript_len)
873{

Callers 10

trim_maximum_feerateFunction · 0.85
calc_weightFunction · 0.85
spend_anchorFunction · 0.85
param_outputsFunction · 0.85
json_withdrawFunction · 0.85
newaddr_sweep_doneFunction · 0.85
calc_weightFunction · 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