Matt Corallo
224fb05cc5
Rebroadcast shutdown on channel_reestablish (and reprocess them)
2018-11-02 22:26:51 -04:00
Matt Corallo
527d036c1b
Delay closing_signed until update_fee exchanges complete
...
See https://github.com/lightningnetwork/lightning-rfc/issues/499
for a bit more about the ambiguity we're addressing here.
Also drop holding cell update_fee the same way we drop holding
cell update_add_htlcs when sending shutdown, resolving a bug.
2018-11-02 22:26:51 -04:00
Matt Corallo
78232f2aed
Fail incoming HTLCs sent after we start shutdown, not the chan
2018-11-02 22:26:51 -04:00
Matt Corallo
a11e27d20e
Send closing_signed when appropriate as pending HTLCs clear
2018-11-01 17:08:53 -04:00
Matt Corallo
1993ec0d12
Always send Shutdown resposnes to Shutdown messages
...
We always require that any changes to Channel state be committed
immediately (within the same lock) so we should never have
uncommitted changes which would prevent us from sending a Shutdown
response.
2018-11-01 17:06:07 -04:00
Matt Corallo
7bb598e525
Refactor out first-closing-sent creation
2018-11-01 17:05:56 -04:00
Matt Corallo
4eb8a4905c
Use ChannelError in shutdown handling, clean up, impl err actions
2018-11-01 13:50:03 -04:00
Schalk van Heerden
a0be4d1758
Added config interface to allow users to specify channel limits
2018-10-31 15:45:30 -04:00
Matt Corallo
9189d0e61d
Require at least 1k sat for outbound channels and meet BTC's dust
2018-10-31 15:45:30 -04:00
Matt Corallo
55a74b5dab
Use non-funder's funding block wait instead of max with ours
...
This is both required by the protocol and also makes sense - if
we're the funder we don't mind accepting payment on the channel
after one confirmation because we assume we won't double-spend
ourselves.
2018-10-31 15:45:30 -04:00
Matt Corallo
4a51f4f073
fix broken state comparison (thanks @yuntai!)
2018-10-27 09:58:10 -04:00
Matt Corallo
6ed5a829bb
Fix + test disconnect/reconnect prior to FundingLocked
2018-10-27 09:58:10 -04:00
Matt Corallo
a2fb3ccc08
Implement and document Channel/ChannelManager (de)serialization
2018-10-27 09:58:10 -04:00
Matt Corallo
b2bd64d2eb
Store+expose bits of Channel[Monitor] to figure out local state
2018-10-27 09:42:04 -04:00
Matt Corallo
56513f2927
Track last_block_hash in ChannelMonitor and expose it on deser
...
Also make block_connected take a &mut self to ensure serialized
state will always be self-consistent.
2018-10-27 09:42:04 -04:00
Matt Corallo
47fe673c57
Give ChannelMonitor a logger via new ReadableArgs trait
2018-10-27 09:42:04 -04:00
Matt Corallo
c0c139cdc2
Fix and test update_add_htlc but disconnect pre-commitment_signed
2018-10-27 09:42:04 -04:00
Matt Corallo
e2de49ddc4
Respond to channel_reestablish out-of-band for ordered delivery
2018-10-27 09:42:04 -04:00
Antoine Riard
5180686b1d
Integrate destination_script from KeysInterface in ChannelManager/Channel
...
Drop channel_monitor_claim_key from ChannelKeys
2018-10-27 09:42:04 -04:00
Antoine Riard
32a9378909
Integrate shutdown_pubkey from KeysInterface in ChannelManager/Channel
...
Drop channel_close_key from ChannelKeys
2018-10-27 09:42:04 -04:00
Antoine Riard
e361fed0f1
Integrate KeysInterface to ChannelManager with Arc
2018-10-27 09:42:04 -04:00
Antoine Riard
d33cb3cca5
Add a KeysInterface which provides keys from user
...
Move ChannelKeys into keysinterface for generate a set of it from
master_seed and change return type to panic on bogus data
2018-10-27 09:34:45 -04:00
Antoine Riard
8c235d9e28
Generate Events from ChannelMonitor to indicate spendable ouputs
...
Extend KeyStorage with delayed_payment_base_key and per_commitment_point
to derive local_delayed private key
2018-10-27 09:34:28 -04:00
Matt Corallo
c36d23107c
Add Channel support for monitor-update-failed pausing
2018-10-23 16:03:30 -04:00
Matt Corallo
695eec23c4
Pull out regenerating RAA/CS in channel_reestablish handling
2018-10-23 16:03:30 -04:00
Matt Corallo
f059d9ce3f
Fix reconnect message order on remote updates while waiting on RAA
2018-10-23 15:26:11 -04:00
Matt Corallo
e86c84b2be
Add message ordering return value to handling channel_reestablish
2018-10-23 15:26:11 -04:00
Yuntai Kyong
d3ca7da672
Some changes in comments and error messages.
2018-10-23 10:50:03 -04:00
Yuntai Kyong
ed30a199e3
Error handling in decoding onion
2018-10-23 10:44:40 -04:00
Matt Corallo
df88525d44
Ensure channel is live, not usable for sending fee updates
...
+ a freebie TODO removal
2018-10-17 21:28:22 -04:00
Matt Corallo
1fe616db5a
Fix + test funding tx confirmation while peer is disconnected
2018-10-16 16:36:29 -04:00
Matt Corallo
17375b0551
Fix channel_reestablish exchanging in case of lost messages
...
This uses the new storage in HTLC state enums to reproduce the
various updates in a CommitmentUpdate group which is obviously
required to re-send a commitment_update after pending unreceived
updates were dropped.
Does not yet handle dropped update_fee updates properly.
2018-10-15 22:03:12 -04:00
Matt Corallo
b4dcbfa569
Store onion packet in OutboundHTLCState so we can regen update_add
2018-10-15 21:52:41 -04:00
Matt Corallo
4b231d5e6d
Store per-state HTLC data in the state enum itself (and store more)
2018-10-15 21:52:41 -04:00
Matt Corallo
99e01b2a64
Further simplify get_{inbound,outbound}_pending_htlc_stats
2018-10-06 12:06:29 +09:00
Yuntai Kyong
1f93a838c7
Split get_pending_htlc_stats
...
to get_inbound_pending_htlc_stats and get_outbound_pending_htlc_stats
2018-10-06 12:06:29 +09:00
Matt Corallo
e5974ce643
Check that reserves are met or progress is made on commitment tx gen
2018-10-06 12:06:29 +09:00
Yuntai Kyong
02b28d4513
Add simple test for channel_reserve/max_htlc_value_in_flight_msat
2018-10-06 12:06:29 +09:00
Yuntai Kyong
c6cc30d9d7
Add a ChannelValueStat getter to simplify tests
2018-10-06 12:03:24 +09:00
Yuntai Kyong
dc4a8c1de2
Document channel reserve behavior a bit better
2018-10-06 12:01:37 +09:00
Yuntai Kyong
f8cfc4228c
Fix checking of channel_reserve values
2018-10-06 12:01:31 +09:00
Yuntai Kyong
18ce6c8fd8
add a ChannelUnavailable error
2018-10-03 08:45:34 +09:00
Yuntai Kyong
eff730af18
raise APIError from close_channel
2018-10-03 08:36:39 +09:00
Matt Corallo
3f2d379835
Use new ChannelError in get_channel_announcement
2018-09-30 20:07:44 -04:00
Matt Corallo
ff644f4517
Use new ChannelError in channel_reestablish handling
2018-09-30 20:05:39 -04:00
Matt Corallo
ad77f72ff3
Use new ChannelError in HTLC-removal msgs, filling out more handling
2018-09-30 20:05:39 -04:00
Matt Corallo
662485a4dd
Use new ChannelError in funding_locked, filling out more handling
2018-09-30 20:05:39 -04:00
Matt Corallo
625e2b3532
Use new ChannelError type in accept_channel
2018-09-30 20:05:39 -04:00
Matt Corallo
aa2021dff5
Introduce a Channel-specific Err type and return it in a few places
...
This is way simpler than writing out the whole ErrorAction mess and
we can just convert it as appropriate in ChannelManager.
2018-09-30 20:05:38 -04:00
Yuntai Kyong
1dbc6fb0ef
Implement update_fee handling
2018-09-29 19:58:08 -04:00