| 484 | } |
| 485 | |
| 486 | void wally_txid(const struct wally_tx *wtx, struct bitcoin_txid *txid) |
| 487 | { |
| 488 | u8 *arr; |
| 489 | size_t len, written; |
| 490 | int res; |
| 491 | |
| 492 | /* Never use BIP141 form for txid */ |
| 493 | res = wally_tx_get_length(wtx, 0, &len); |
| 494 | assert(res == WALLY_OK); |
| 495 | arr = tal_arr(NULL, u8, len); |
| 496 | res = wally_tx_to_bytes(wtx, 0, arr, len, &written); |
| 497 | assert(len == written); |
| 498 | |
| 499 | sha256_double(&txid->shad, arr, len); |
| 500 | tal_free(arr); |
| 501 | } |
| 502 | |
| 503 | /* We used to have beautiful, optimal code which fed the tx parts directly |
| 504 | * into sha256_update(). But that was before libwally; but now we don't have |
no test coverage detected