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

Function elements_tx_overhead

bitcoin/tx.h:255–277  ·  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

253 * output will add 9 bytes and the per output overhead as well.
254 */
255static inline size_t elements_tx_overhead(const struct chainparams *chainparams,
256 size_t incount, size_t outcount)
257{
258 size_t overhead;
259
260 if (!chainparams->is_elements)
261 return 0;
262
263 /* Each transaction has surjection and rangeproof (both empty
264 * for us as long as we use unblinded L-BTC transactions). */
265 overhead = 2 * 4;
266 /* For elements we also need to add the fee output and the
267 * overhead for rangeproofs into the mix. */
268 overhead += (8 + 1) * 4; /* Bitcoin style output */
269
270 /* All outputs have a bit of elements overhead (incl fee) */
271 overhead += (32 + 1 + 1 + 1) * 4 * (outcount + 1); /* Elements added fields */
272
273 /* Inputs have 6 bytes of blank proofs attached. */
274 overhead += 6 * incount;
275
276 return overhead;
277}
278
279/**
280 * Calculate the fees for this transaction

Callers 7

set_htlc_timeout_feeFunction · 0.85
get_htlc_success_feeFunction · 0.85
penalty_tx_createFunction · 0.85
onchaind_tx_unsignedFunction · 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