This resolves a spec-compliance bug with BOLT 4 where we simply
failed to deserialize the message and thus could never return an
HTLC failure message. However, note that BOLT 4 incorrectly hints
that a non-malformed message should be used ("...MUST report a
route failure to the origin node") which we cannot do as we cannot
derive a SharedSecret to encrypt a regular update_fail_htlc message
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.
This fixes a violation of BOLT 2 and will let us consolidate some
HTLC update handling. Good bit of code movement, but is mostly
refactor to store HTLC failure status in pending_htlcs in Channel.
Sha256 in fuzztarget was updated some time ago to use XOR instead
of the first byte of a real SHA256 run and somehow received and
sent payments got crossed in full_stack_target.
Implement error, warn, info, debug and trace macros, internally calling
an instance of Logger, and passing it to every main structures
Build-time or client-side filtering.
Issue #54
For some reason we were only setting "announce_publicly" when
Channel::new_from_req had announce_publicly set to true and the
open_channel message had the relevant flag set. However, this
resulted in us rejecting peers for sending unsolicited
announcement_signatures messages, despite them having indicated,
and us having accepted, their announce-bit-set open_channel.
Add test for DisconnectPeer event
Update DisconnectPeer with optional ErrorMessage
Manage error for funding_transaction_generated
Add disconnect_socket to SocketDescriptor trait
Summary:
Implementing these, taking inspiration from the surrounding code since i'm a rust n00b.
Test Plan:
```
cargo build
cargo test channel_reestablish
```
output:
```
running 3 tests
test ln::msgs::tests::encoding_channel_reestablish_with_secret ... ok
test ln::msgs::tests::decode_channel_reestablish_bad_length ... ok
test ln::msgs::tests::encoding_channel_reestablish_no_secret ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 14 filtered out
```
This structure replaces the (Sha256dHash, u16) tuple that was being used
for the funding output.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>