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. */
| 253 | * output will add 9 bytes and the per output overhead as well. |
| 254 | */ |
| 255 | static 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 |
no outgoing calls
no test coverage detected