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
f0490118b3
impl some additional (de)serializers, including a u48 wrapper type
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
062a02da1a
Add a second Readable trait for state args, clean macros slightly
2018-10-27 09:42:04 -04:00
Matt Corallo
249aa77550
Send channel_reestablish out-of-band to ensure ordered deliver
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
Matt Corallo
4342114345
Send RAA/CS messages out-of-band to ensure ordered delivery
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
e382a7b4b3
Send announcement_signatures msgs out-of-band for ordered delivery
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
608d517f92
Send AcceptChannel responses out-of-band to ensure ordered delivery
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
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
Yuntai Kyong
bdbb2f077e
Comments updated for PaymentReceived
2018-10-25 20:15:21 -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
b02670a920
Add an Event for sending revoke_and_ack messages out-of-band
2018-10-23 16:03:30 -04:00
Matt Corallo
e86c84b2be
Add message ordering return value to handling channel_reestablish
2018-10-23 15:26:11 -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
Matt Corallo
d49802fb8f
Use APIError::ChannelUnavailable a bit more for consistency
2018-10-17 21:28:22 -04:00
Matt Corallo
c52616ddd7
Add documentation about PaymentSent/Failed event duplication bug
2018-10-15 23:06:04 -04:00
Yuntai Kyong
18ce6c8fd8
add a ChannelUnavailable error
2018-10-03 08:45:34 +09:00
Matt Corallo
6e1318b0e2
Make docs look nicer by adding explicit spacing
2018-09-20 12:58:10 -04:00
Matt Corallo
79a0a0c959
Migrate ChannelMonitor serialization to new ser framework(ish)
...
Sadly we can't straight up use the new serialization framework as
we have a few different serialization variants, but that's OK, it
looks identical and is just missing the Writeable impl
2018-09-20 10:46:13 -04:00
Matt Corallo
28d0d44e44
Move ChannelMonitor deserialization to new ser framework
2018-09-20 10:46:13 -04:00
Matt Corallo
c43e535bc0
Simplify DecodeError enum by removing some useless distinctions
2018-09-20 10:46:12 -04:00
Matt Corallo
3aeec96470
Add module and all-pub-things docs and deny missing docs
2018-09-19 23:07:02 -04:00
Matt Corallo
a4528faa54
Document all the fields in Errors
2018-09-19 23:07:02 -04:00
Matt Corallo
c91f72c131
Drop MsgEncodable in favor of default fns on Writeable
2018-09-16 14:33:50 -04:00
Matt Corallo
e8a66ef0ea
Make Writeable::write typed instead of Writeable
...
This lets us add some untyped default functions to the trait
2018-09-16 14:33:50 -04:00
Matt Corallo
8322c756cb
Stop checking size > 64KB in serialization
...
This removes a bunch of potentially new error handling in writers
and the checks were kinda useless anyway - in normal operation we
unwrap()ed anyway, and we're gonna want to use the serializtion
framework for ChannelMonitor/ChannelManager serialization, which
may generate things larger than 64KB anyway.
2018-09-16 14:33:50 -04:00
Matt Corallo
712051a9fc
Add size_hint in ser and call size_hint in all message serializers
2018-09-16 14:33:50 -04:00
Matt Corallo
ee9533a905
Split out Vec<u8> and Vec<Signature> ser impls cause there's 2
...
Should resolve any performance issues with Vec<u8> serialization.
2018-09-16 14:33:50 -04:00
Matt Corallo
1f1f82569a
Simplify serialization a bit by removing the useless newtypes
2018-09-16 14:33:50 -04:00
Matt Corallo
51ba6ad2e9
Expose (de)serialziers as we'll need them and I don't like warnings
2018-09-16 14:33:48 -04:00
Matt Corallo
12a50627a3
Add channel_reestablish + peer_connected events to channel handler
2018-09-15 10:53:16 -04:00
Matt Corallo
77c2622615
Merge pull request #175 from TheBlueMatt/2018-09-173-whitespace-err
...
raise APIError from send_payment (#173 without whitespace nit)
2018-09-13 13:11:51 -04:00
Yuntai Kyong
ec743351b1
raise APIError from send_payment
...
add APIError::RouteError
2018-09-13 11:18:03 -04:00
Matt Corallo
d7ed4c63e7
Correct MAX_BUF_SIZE in serialization
...
I think this might have been my fault due to faulty review
feedback, but fuzzer caught trivial crash here where you try to
send a ping message larger than 16KB (but smaller than the
max-length 64KB) and you crash as message serialization is unwrap()
2018-09-12 13:22:42 -04:00
Matt Corallo
c3e225597d
Fix some double-indentation in util/ser
2018-09-12 13:22:42 -04:00
Yuntai Kyong
1b8504a3f3
Implement Writer/Reader
...
with additional variants in DecodeError
2018-09-12 10:18:02 -04:00
Matt Corallo
f78d7299d6
Also fwd channel_update and node_announcement immediately
...
Not really sure why the API was different for channel_announcement,
but this brings everything in sync.
2018-08-29 18:07:56 -04:00
Matt Corallo
a3247abb4e
Handle Error messages by closing channels as required by BOLT 1
2018-08-25 17:20:58 -04:00
Matt Corallo
ab00e4ccff
Merge HTLC-update events, remove FailHTLC ErrorAction
...
UpdateFailHTLC isn't really an error anymore now that its handled
async after channel commitment (as required by BOLT 2), and since
its unused this is free. To resolve the TODO which intended to use
it for HTLC failure when trying to route forwards, we instead opt
to merge all the HTLC update events into one UpdateHTLCs event
which just contains a CommitmentUpdate object.
2018-08-23 16:11:20 -04:00
Matt Corallo
11e5975523
Update to rust-secp256k1 v0.11 and rust-bitcoin v0.14
2018-08-23 14:52:43 -04:00
Matt Corallo
5ee88ad9f2
Clean up excess \ns in route debug, use all debug encoders
2018-08-23 14:52:43 -04:00
Antoine Riard
0523403887
Add Display trait on network structs for routing bug track
2018-08-23 14:52:42 -04:00
Matt Corallo
42086c94a0
Remove implicit Record import requirement in logging macros
2018-08-20 13:33:09 -04:00
Matt Corallo
7743cbdf14
Add APIError docs
2018-08-17 17:36:50 -04:00
Yuntai Kyong
4553369d20
Add APIError enum
...
`APIMisuse` when paramters passed from the client is invalid
`FeeRateTooHigh` when a channel cannot be opened due to high feerate
2018-08-17 13:09:30 -04:00