| 984 | } |
| 985 | |
| 986 | void psbt_txid(const tal_t *ctx, |
| 987 | const struct wally_psbt *psbt, |
| 988 | struct bitcoin_txid *txid, |
| 989 | struct wally_tx **wtx) |
| 990 | { |
| 991 | struct wally_tx *tx; |
| 992 | int wally_err; |
| 993 | assert(psbt->version == 2); |
| 994 | |
| 995 | /* We rely on wally extractor to fill out all txid-related fields including scriptSigs */ |
| 996 | tal_wally_start(); |
| 997 | wally_err = wally_psbt_extract(psbt, WALLY_PSBT_EXTRACT_NON_FINAL, &tx); |
| 998 | assert(wally_err == WALLY_OK); |
| 999 | wally_err = wally_tx_get_txid(tx, txid->shad.sha.u.u8, sizeof(txid->shad.sha.u.u8)); |
| 1000 | assert(wally_err == WALLY_OK); |
| 1001 | tal_wally_end(ctx); |
| 1002 | |
| 1003 | if (wtx) |
| 1004 | *wtx = tx; |
| 1005 | else |
| 1006 | wally_tx_free(tx); |
| 1007 | } |
| 1008 | |
| 1009 | struct amount_sat psbt_compute_fee(const struct wally_psbt *psbt) |
| 1010 | { |
no test coverage detected