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

Function elements_tx_overhead

bitcoin/tx.h:240–262  ·  view source on GitHub ↗

Attempt to compute the elements overhead given a base bitcoin size. * * The overhead consists of 2 empty proofs for the transaction, 6 bytes of * proofs per input and 35 bytes per output. In addition the explicit fee * output will add 9 bytes and the per output overhead as well. */

Source from the content-addressed store, hash-verified

238 * output will add 9 bytes and the per output overhead as well.
239 */
240static inline size_t elements_tx_overhead(const struct chainparams *chainparams,
241 size_t incount, size_t outcount)
242{
243 size_t overhead;
244
245 if (!chainparams->is_elements)
246 return 0;
247
248 /* Each transaction has surjection and rangeproof (both empty
249 * for us as long as we use unblinded L-BTC transactions). */
250 overhead = 2 * 4;
251 /* For elements we also need to add the fee output and the
252 * overhead for rangeproofs into the mix. */
253 overhead += (8 + 1) * 4; /* Bitcoin style output */
254
255 /* All outputs have a bit of elements overhead (incl fee) */
256 overhead += (32 + 1 + 1 + 1) * 4 * (outcount + 1); /* Elements added fields */
257
258 /* Inputs have 6 bytes of blank proofs attached. */
259 overhead += 6 * incount;
260
261 return overhead;
262}
263
264/**
265 * Calculate the fees for this transaction

Callers 7

set_htlc_timeout_feeFunction · 0.85
set_htlc_success_feeFunction · 0.85
tx_to_usFunction · 0.85
penalty_tx_createFunction · 0.85
commit_tx_base_weightFunction · 0.85
htlc_timeout_feeFunction · 0.85
htlc_success_feeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected