| 465 | } |
| 466 | |
| 467 | size_t bitcoin_tx_weight(const struct bitcoin_tx *tx) |
| 468 | { |
| 469 | size_t extra; |
| 470 | size_t num_witnesses; |
| 471 | |
| 472 | /* If we don't have witnesses *yet*, libwally doesn't encode |
| 473 | * in BIP 141 style, omitting the flag and marker bytes */ |
| 474 | wally_tx_get_witness_count(tx->wtx, &num_witnesses); |
| 475 | if (num_witnesses == 0) { |
| 476 | if (chainparams->is_elements) |
| 477 | extra = 7; |
| 478 | else |
| 479 | extra = 2; |
| 480 | } else |
| 481 | extra = 0; |
| 482 | |
| 483 | return extra + wally_tx_weight(tx->wtx); |
| 484 | } |
| 485 | |
| 486 | void wally_txid(const struct wally_tx *wtx, struct bitcoin_txid *txid) |
| 487 | { |
no test coverage detected