mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
channeld/lightningd/hsmd: strengthen our checks against 0-output txs.
If we ever do this, we'd end up with an unspendable commitment tx anyway. It might be able to happen if we have htlcs added from the non-fee-paying party while the fees are increased, though. But better to close the channel and get a report about it if that happens. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -242,6 +242,14 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
|
||||
n++;
|
||||
}
|
||||
|
||||
/* BOLT #2:
|
||||
*
|
||||
* - MUST set `channel_reserve_satoshis` greater than or equal to
|
||||
* `dust_limit_satoshis`.
|
||||
*/
|
||||
/* This means there must be at least one output. */
|
||||
assert(n > 0);
|
||||
|
||||
assert(n <= tx->wtx->outputs_allocation_len);
|
||||
tal_resize(htlcmap, n);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user