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