core-lightning/channeld
Rusty Russell c96cee9b8d channeld: fix invalid assumption in htlc restore.
A long time ago (93dcd5fed7), I
simplified the htlc reload code so it adjusted the amounts for HTLCs
in id order.  As we presumably allowed them to be added in that order,
this avoided special-casing overflow (which was about to deliberately
be made harder by the new amount_msat code).

Unfortunately, htlc id order is not canonical, since htlc ids are
assigned consecutively in both directions!  Concretely, we can have two HTLCs:

	HTLC #0 LOCAL->REMOTE: 500,000,000 msat, state RCVD_REMOVE_REVOCATION
	HTLC #0 REMOTE->LOCAL: 10,000 msat, state SENT_ADD_COMMIT

On a new remote-funded channel, in which we have 0 balance, these
commits *only* work in this order.  Sorting by HTLC ID is not enough!
In fact, we'd have to worry about redemption order as well, as that
matters.

So, regretfully, we offset the balances halfway to UINT64_MAX, then check
they didn't underflow at the end.  This loses us this one sanity check,
but that's probably OK.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-11-05 22:38:07 +01:00
..
test elements: Remove global is_elements variable in favor of chainparams 2019-10-03 04:32:57 +00:00
channel_wire.csv JSON-API: Allow close channel to specified address 2019-10-09 21:04:16 -05:00
channeld_htlc.h channeld: get current block height when an HTLC fails. 2019-08-29 09:01:48 +02:00
channeld.c funding: integration tests for close_to 2019-10-15 19:10:05 +02:00
commit_tx.c elements: Change function prefix to elements_ for some functions 2019-10-03 04:32:57 +00:00
commit_tx.h tx: Add chainparams to struct bitcoin_tx as context 2019-07-31 23:22:54 +00:00
full_channel_error.h channeld: map htlc add/remove errors to names. 2018-02-19 02:56:51 +00:00
full_channel.c channeld: fix invalid assumption in htlc restore. 2019-11-05 22:38:07 +01:00
full_channel.h channeld: set option_static_remotekey when negotiated. 2019-09-10 16:18:25 -05:00
Makefile per-peer-daemons: tie in gossip filter. 2019-09-06 14:35:01 +02:00