| 560 | } |
| 561 | |
| 562 | static struct wally_tx *pull_wtx(const tal_t *ctx, |
| 563 | const u8 **cursor, |
| 564 | size_t *max) |
| 565 | { |
| 566 | int flags = WALLY_TX_FLAG_USE_WITNESS; |
| 567 | struct wally_tx *wtx; |
| 568 | |
| 569 | if (chainparams->is_elements) |
| 570 | flags |= WALLY_TX_FLAG_USE_ELEMENTS; |
| 571 | |
| 572 | tal_wally_start(); |
| 573 | if (wally_tx_from_bytes(*cursor, *max, flags, &wtx) != WALLY_OK) { |
| 574 | fromwire_fail(cursor, max); |
| 575 | wtx = tal_free(wtx); |
| 576 | } |
| 577 | tal_wally_end_onto(ctx, wtx, struct wally_tx); |
| 578 | |
| 579 | if (wtx) { |
| 580 | size_t wsize; |
| 581 | wally_tx_get_length(wtx, flags, &wsize); |
| 582 | *cursor += wsize; |
| 583 | *max -= wsize; |
| 584 | } |
| 585 | |
| 586 | return wtx; |
| 587 | } |
| 588 | |
| 589 | struct bitcoin_tx *pull_bitcoin_tx(const tal_t *ctx, const u8 **cursor, |
| 590 | size_t *max) |
no test coverage detected