| 1637 | } |
| 1638 | |
| 1639 | static bool check_funding_details(const struct bitcoin_tx *tx, |
| 1640 | const u8 *wscript, |
| 1641 | struct amount_sat funding, |
| 1642 | u32 funding_outnum) |
| 1643 | { |
| 1644 | struct amount_asset asset; |
| 1645 | |
| 1646 | if (funding_outnum >= tx->wtx->num_outputs) |
| 1647 | return false; |
| 1648 | |
| 1649 | asset = bitcoin_tx_output_get_amount(tx, funding_outnum); |
| 1650 | |
| 1651 | if (!amount_asset_is_main(&asset)) |
| 1652 | return false; |
| 1653 | |
| 1654 | if (!amount_sat_eq(amount_asset_to_sat(&asset), funding)) |
| 1655 | return false; |
| 1656 | |
| 1657 | return scripteq(scriptpubkey_p2wsh(tmpctx, wscript), |
| 1658 | bitcoin_tx_output_get_script(tmpctx, tx, |
| 1659 | funding_outnum)); |
| 1660 | } |
| 1661 | |
| 1662 | |
| 1663 | /* FIXME: Unify our watch code so we get notified by txout, instead, like |
no test coverage detected