Commit graph

2317 commits

Author SHA1 Message Date
Yuntai Kyong
f133554697 Add PaymentFailReason for fail_htlc_backwards
to indicate fail reason after a PaymentReceived event
2018-10-25 21:24:53 +09:00
Matt Corallo
c662dd3e94 Fix XXXs that slipped into router and handle HTLCFailCHannelUpdates 2018-10-24 00:44:15 -04:00
Matt Corallo
3bcd911fcb
Merge pull request #213 from TheBlueMatt/2018-10-monitor-fail-pause
Add  ChannelManager support for monitor update failure in one place
2018-10-23 16:45:50 -04:00
Matt Corallo
497643a65b Add basic sanity testing for channel monitor update failure handle 2018-10-23 16:03:30 -04:00
Matt Corallo
267b9a44df ChannelManager support for monitor update failure in one place 2018-10-23 16:03:30 -04:00
Matt Corallo
c36d23107c Add Channel support for monitor-update-failed pausing 2018-10-23 16:03:30 -04:00
Matt Corallo
b02670a920 Add an Event for sending revoke_and_ack messages out-of-band 2018-10-23 16:03:30 -04:00
Matt Corallo
4cca933288 Pull out the HTLC forwarding loop into a function 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
bd2c839a73 Move channel monitor updates inside the channel_state lock
This really, really sucks as it defeats almost all of the
cross-channel parallelism we'd intended to have - waiting on a
client to update a watchtower for an unrelated channel to process
any messages is really shitty. We should revisit this with
per-channel locks as a compile-time option post-0.1.
2018-10-23 16:03:30 -04:00
Matt Corallo
65b23d8d8a
Merge pull request #212 from TheBlueMatt/2018-10-two-updates-disconnect
Fix reconnect message order on remote updates while waiting on RAA
2018-10-23 16:03:08 -04:00
Matt Corallo
13b80ce805 Add test for two-updates-in-flight disconnect channel resumption 2018-10-23 15:26:11 -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
Matt Corallo
270d1bd006
Merge pull request #219 from TheBlueMatt/2018-10-157-merge
Partially implement more onion error handling for sent payments
2018-10-23 15:25:07 -04:00
Yuntai Kyong
920d1458c4 Move HTLCFailChannelUpdate handling out-of-band
While this isn't neccessary for message ordering consistency, this
does mean that we won't end up processing an HTLCFailChannelUpdate
from a update_fail_htlc prior to it being fully committed (where if
the peer disconnects/reconnects it could theoretically give us a
different result, eg if their next-hop reconnected to them).
2018-10-23 14:01:21 -04:00
Yuntai Kyong
dc61c98773 Partially implement more onion error handling for sent payments
Also refactor out onion error handling into a function instead of
in update_fail_htlc.

Cache the initial htlc_msat that we sent instead of recalculating
it to check validity of the error returned.
2018-10-23 13:54:57 -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
Yuntai Kyong
ba30061c87 Add is_permanent field to ChannelClosed message and add NodeFailure
message
2018-10-23 10:30:49 -04:00
Matt Corallo
d318184c9e Avoid needless on-chain channel failing for timing-out HTLCs
See new comments in code for more details
2018-10-22 11:49:57 -04:00
Matt Corallo
0baf72bbdf
Merge pull request #211 from TheBlueMatt/2018-10-misc-cleanups
Miscellaneous Cleanups
2018-10-18 09:34:35 -04:00
Matt Corallo
da70db2946 Test double-reconnect 2018-10-17 21:28:22 -04:00
Matt Corallo
d49802fb8f Use APIError::ChannelUnavailable a bit more for consistency 2018-10-17 21:28:22 -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
b4299bcc9a Use live, not usable for list_usable_channels 2018-10-17 21:28:22 -04:00
Matt Corallo
4cb059e7b9
Merge pull request #210 from TheBlueMatt/2018-10-funding-disconnected
Fix + test funding tx confirmation while peer is disconnected
2018-10-16 21:05:17 -04:00
Matt Corallo
1fe616db5a Fix + test funding tx confirmation while peer is disconnected 2018-10-16 16:36:29 -04:00
Matt Corallo
41f1e16805
Merge pull request #208 from TheBlueMatt/2018-10-reconnect-fixes
Fix channel_reestablish exchanging in case of lost messages
2018-10-16 13:17:28 -04:00
Matt Corallo
c52616ddd7 Add documentation about PaymentSent/Failed event duplication bug 2018-10-15 23:06:04 -04:00
Matt Corallo
01ba5aaa08 Test reconnecting after lost message(s) during the commitment dance 2018-10-15 23:06:04 -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
1479b38759 Split create_chan_between_nodes into two steps 2018-10-15 21:52:41 -04:00
Matt Corallo
84d779a651
Merge pull request #206 from TheBlueMatt/2018-10-189-rebase
#189 rebased
2018-10-05 20:49:26 -07: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
2a5cd48acb Add test for channel_reserve with holding cell HTLCs counted 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
634bb26191 Break up test channel creation to specify values explicitly 2018-10-06 12:03:39 +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
Matt Corallo
a82a5f71da
Merge pull request #196 from yuntai/shutdown-apify
Raise APIError from close_channel
2018-10-05 18:32:24 -07: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
84953fc68f
Merge pull request #201 from TheBlueMatt/2018-09-channelerror-1
Introduce a Channel-specific Err type and return it in a few places
2018-10-01 10:32:00 -04:00
Matt Corallo
3f2d379835 Use new ChannelError in get_channel_announcement 2018-09-30 20:07:44 -04:00