Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

peer_control: Fix check_funding_details assert #5378

Merged
merged 1 commit into from
Jul 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1437,13 +1437,14 @@ static bool check_funding_details(const struct bitcoin_tx *tx,
struct amount_sat funding,
u32 funding_outnum)
{
struct amount_asset asset =
bitcoin_tx_output_get_amount(tx, funding_outnum);
struct amount_asset asset;

if (!amount_asset_is_main(&asset))
if (funding_outnum >= tx->wtx->num_outputs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think that in this case can be necessary to add a log line at debug level? or this check will be pretty clear to debug if happens ?

return false;

if (funding_outnum >= tx->wtx->num_outputs)
asset = bitcoin_tx_output_get_amount(tx, funding_outnum);

if (!amount_asset_is_main(&asset))
return false;

if (!amount_sat_eq(amount_asset_to_sat(&asset), funding))
Expand Down