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:
Rusty Russell
2019-06-27 09:55:17 +09:30
parent 960bfb89f5
commit a450962b49
3 changed files with 42 additions and 0 deletions

View File

@@ -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);