FIXME: Unify our watch code so we get notified by txout, instead, like * the wallet code does. */
| 1663 | /* FIXME: Unify our watch code so we get notified by txout, instead, like |
| 1664 | * the wallet code does. */ |
| 1665 | static bool check_funding_tx(const struct bitcoin_tx *tx, |
| 1666 | const struct channel *channel) |
| 1667 | { |
| 1668 | struct channel_inflight *inflight; |
| 1669 | const u8 *wscript; |
| 1670 | wscript = bitcoin_redeem_2of2(tmpctx, |
| 1671 | &channel->local_funding_pubkey, |
| 1672 | &channel->channel_info.remote_fundingkey); |
| 1673 | |
| 1674 | /* Since we've enabled "RBF" for funding transactions, |
| 1675 | * it's possible that it's one of "inflights". |
| 1676 | * Worth noting that this check was added to prevent |
| 1677 | * a peer from sending us a 'bogus' transaction id (that didn't |
| 1678 | * actually contain the funding output). As of v2 (where |
| 1679 | * RBF is introduced), this isn't a problem so much as |
| 1680 | * both sides have full access to the funding transaction */ |
| 1681 | if (check_funding_details(tx, wscript, channel->funding_sats, |
| 1682 | channel->funding.n)) |
| 1683 | return true; |
| 1684 | |
| 1685 | list_for_each(&channel->inflights, inflight, list) { |
| 1686 | if (check_funding_details(tx, wscript, |
| 1687 | inflight->funding->total_funds, |
| 1688 | inflight->funding->outpoint.n)) |
| 1689 | return true; |
| 1690 | } |
| 1691 | return false; |
| 1692 | } |
| 1693 | |
| 1694 | static void update_channel_from_inflight(struct lightningd *ld, |
| 1695 | struct channel *channel, |
no test coverage detected