mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-05 23:24:21 +01:00
lightningd, openingd: remove active code inside assert().
We don't compile with NDEBUG defined, but if we did, this code would vanish. I did a quick audit, inspired by @ZmnSCPxj. I actually hacked up something to compile with NDEBUG (many unused vars resulted, and of course unit tests are allowed to rely on assert()), and after this the testsuite still passes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -852,7 +852,13 @@ static u8 *funder_channel_complete(struct state *state)
|
||||
|
||||
/* We recalculate the local_msat from cached values; should
|
||||
* succeed because we checked it earlier */
|
||||
assert(amount_sat_sub_msat(&local_msat, state->funding, state->push_msat));
|
||||
if (!amount_sat_sub_msat(&local_msat, state->funding, state->push_msat))
|
||||
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
||||
"push_msat %s > funding %s?",
|
||||
type_to_string(tmpctx, struct amount_msat,
|
||||
&state->push_msat),
|
||||
type_to_string(tmpctx, struct amount_sat,
|
||||
&state->funding));
|
||||
|
||||
if (!funder_finalize_channel_setup(state, local_msat, &sig, &tx))
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user