MCPcopy Create free account
hub / github.com/ElementsProject/lightning / check_funding_details

Function check_funding_details

lightningd/peer_control.c:1639–1660  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1637}
1638
1639static 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

Callers 1

check_funding_txFunction · 0.85

Calls 7

scripteqFunction · 0.85
amount_asset_is_mainFunction · 0.50
amount_sat_eqFunction · 0.50
amount_asset_to_satFunction · 0.50
scriptpubkey_p2wshFunction · 0.50

Tested by

no test coverage detected