| 472 | } |
| 473 | |
| 474 | void wally_txid(const struct wally_tx *wtx, struct bitcoin_txid *txid) |
| 475 | { |
| 476 | u8 *arr; |
| 477 | size_t len, written; |
| 478 | int res; |
| 479 | |
| 480 | /* Never use BIP141 form for txid */ |
| 481 | res = wally_tx_get_length(wtx, 0, &len); |
| 482 | assert(res == WALLY_OK); |
| 483 | arr = tal_arr(NULL, u8, len); |
| 484 | res = wally_tx_to_bytes(wtx, 0, arr, len, &written); |
| 485 | assert(len == written); |
| 486 | |
| 487 | sha256_double(&txid->shad, arr, len); |
| 488 | tal_free(arr); |
| 489 | } |
| 490 | |
| 491 | /* We used to have beautiful, optimal code which fed the tx parts directly |
| 492 | * into sha256_update(). But that was before libwally; but now we don't have |
no test coverage detected