| 453 | } |
| 454 | |
| 455 | size_t bitcoin_tx_weight(const struct bitcoin_tx *tx) |
| 456 | { |
| 457 | size_t extra; |
| 458 | size_t num_witnesses; |
| 459 | |
| 460 | /* If we don't have witnesses *yet*, libwally doesn't encode |
| 461 | * in BIP 141 style, omitting the flag and marker bytes */ |
| 462 | wally_tx_get_witness_count(tx->wtx, &num_witnesses); |
| 463 | if (num_witnesses == 0) { |
| 464 | if (chainparams->is_elements) |
| 465 | extra = 7; |
| 466 | else |
| 467 | extra = 2; |
| 468 | } else |
| 469 | extra = 0; |
| 470 | |
| 471 | return extra + wally_tx_weight(tx->wtx); |
| 472 | } |
| 473 | |
| 474 | void wally_txid(const struct wally_tx *wtx, struct bitcoin_txid *txid) |
| 475 | { |
no test coverage detected