Commit graph

836 commits

Author SHA1 Message Date
Antoine Riard
6d5dc6c9b4 Implement KeysInterface for KeysManager util 2018-10-27 09:42:04 -04:00
Matt Corallo
612e2801f8 Redo ChannelMonitor deserialization to avoid read_to_end()
This slightly changes the serialization format, but we're still
early enough that that's OK.
2018-10-27 09:42:04 -04:00
Matt Corallo
812f255d7c Send shutdown/closing_signed msgs out-of-band for ordered delivery 2018-10-27 09:42:04 -04:00
Matt Corallo
f0490118b3 impl some additional (de)serializers, including a u48 wrapper type 2018-10-27 09:42:04 -04:00
Matt Corallo
e382a7b4b3 Send announcement_signatures msgs out-of-band for ordered delivery 2018-10-27 09:42:04 -04:00
Matt Corallo
4eafd37d20 impl Readable/Writable for Route 2018-10-27 09:42:04 -04:00
Matt Corallo
c962a27156 Send funding_signed messages out-of-band to ensure ordered delivery 2018-10-27 09:42:04 -04:00
Matt Corallo
74cec623fd Add a BIG lock to ChannelManager
During normal operation we should never need to take this, so we
use a RwLock that allows normal parallelism until we want to
serialize out our ChannelManager, at which point we can take the
write-mode lock.
2018-10-27 09:42:04 -04:00
Matt Corallo
608d517f92 Send AcceptChannel responses out-of-band to ensure ordered delivery 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
e397cb9960 Split Event, move MessageSendEvent push() inside channel_state lock 2018-10-27 09:42:04 -04:00
Matt Corallo
062a02da1a Add a second Readable trait for state args, clean macros slightly 2018-10-27 09:42:04 -04:00
Matt Corallo
bb43b98e8f Store [u8; 32]s instead of SharedSecrets (for deserialization) 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
70b026c3c5
Merge pull request #224 from TheBlueMatt/2018-10-221-whitespace
#221 with a few trailing spaces removed
2018-10-25 21:21:54 -04:00
Yuntai Kyong
bdbb2f077e Comments updated for PaymentReceived 2018-10-25 20:15:21 -04:00
Matt Corallo
f5ff5d1ad0
Merge pull request #220 from TheBlueMatt/2018-10-oops-xxx
Fix XXXs that slipped into router and handle HTLCFailCHannelUpdates
2018-10-25 15:19:06 -04:00
Matt Corallo
fc8cd9f142 Run travis-fuzz on Rust 1.29.2 due to 1.30 breaking honggfuzz build 2018-10-25 14:33:10 -04:00
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