Antoine Riard
8544d6f9dd
Refactor handle_update_fail_htlc to wrapper error handling function
2018-09-07 21:42:07 +00:00
Antoine Riard
27869ad0ce
Refactor handle_update_fulfill_htlc to wrapper error handling function
2018-09-07 21:36:55 +00:00
Antoine Riard
321534020e
Refactor handle_update_add_htlc to wrapper error handling function
2018-09-07 21:30:00 +00:00
Antoine Riard
699fb3b64e
Refactor handle_closing_signed to wrapper error handling function
2018-09-07 21:21:05 +00:00
Antoine Riard
4b5b48cb57
Refactor handle_shutdown to wrapper error handling function
2018-09-07 03:10:10 +00:00
Antoine Riard
8dfc3c34bc
Refactor handle_funding_locked to wrapper error handling function
2018-09-07 02:58:01 +00:00
Antoine Riard
cdbd7ce71d
Refactor handle_funding_signed to wrapper error handling function
2018-09-07 02:45:07 +00:00
Antoine Riard
e67b715e52
Refactor handle_funding_created to wrapper error handling function
2018-09-06 11:07:44 -04:00
Matt Corallo
a7ad65b21f
Merge pull request #151 from ariard/channel_manager_refactor
...
Refactor handle_accept_channel to wrapper error handling function
2018-09-06 10:45:41 -04:00
Antoine Riard
8c2f0c31d6
Refactor handle_accept_channel to wrapper error handling function
2018-09-06 10:44:23 -04:00
Matt Corallo
3f5f3def63
Add further clarification TODO in finish_force_close_channel
2018-09-05 20:32:16 -04:00
Matt Corallo
8e4c062f1b
Document+check commitment_signed generation success on send_htlc
...
Because we don't have an HTLCState for
update_add_htlc-generated-but-not-yet-commitment_signed to simplify
the mess of HTLCState match arms, any time a Channel::send_htlc
call returns Ok(Some(_)) we MUST call commitment_signed and it MUST
return success (or close the channel). We mention this in the docs
and panic if its not met in ChannelManager (which lets the fuzz
tester check this).
2018-09-05 19:47:01 -04:00
Matt Corallo
91b23a0754
Reject rumors of channels that are from one node back to itself
2018-09-04 22:56:25 -04:00
Matt Corallo
a71abac55a
Move announcement_signatures handling into new force-close macro
...
Because we've separated out channel closure from ErrorMessage
returning we can return error messages in a few additional cases,
like if the peer sent us a message for a channel they didn't own.
2018-09-04 20:27:58 -04:00
Matt Corallo
2202d139c1
Simplify secp_call! macro in ChannelManager
2018-09-04 20:27:58 -04:00
Matt Corallo
8c709d1b6f
Dont return an Err from Channel::get_accept_channel that can't fail
2018-09-04 20:27:55 -04:00
Antoine Riard
4afbc12568
Refactor handle_open_channel to wrapper error handling function
...
Original version is from Antoine Riard <ariard@student.42.fr>,
the error type and some return type fixes are from
Matt Corallo <git@bluematt.me>
2018-09-04 20:19:13 -04:00
Matt Corallo
c578e4a346
Add ChannelManager-specific HandleError type and macro to use it
...
Original macro is from Antoine Riard <ariard@student.42.fr>,
the error type and additional mappings are from
Matt Corallo <git@bluematt.me>
2018-09-04 20:19:07 -04:00
Matt Corallo
cd9d680986
Merge pull request #145 from TheBlueMatt/2018-09-134-rebased
...
#134 rebased
2018-09-03 18:10:51 -04:00
Matt Corallo
5fb2cc4699
Merge pull request #143 from TheBlueMatt/2018-08-announcement_sigs_erroraction
...
Ensure handle_announcement_signatures always has a ErrorAction
2018-09-03 17:44:57 -04:00
Antoine Riard
4b4d8b6b9e
Add test_invalid_channel_announcemnt + test utilities
...
Fix typo
2018-09-03 17:40:12 -04:00
Antoine Riard
2079fe4ad2
Add ChainWatchInterface in Router
2018-09-03 17:40:05 -04:00
Yuntai Kyong
92274c8800
Remove code fragments with no effect
2018-09-02 21:45:44 +09:00
Matt Corallo
c531cb4faa
Ensure handle_announcement_signatures always has a ErrorAction
2018-08-31 17:00:44 -04:00
Matt Corallo
1661d3c6cb
Add ErrorAction in secp Error -> HandleError conv in ChannelManager
2018-08-31 17:00:43 -04:00
Matt Corallo
3fbbd9e8d2
Remove unused feeest field in ChannelManager tests
2018-08-30 15:11:16 -04:00
Matt Corallo
9902fce585
Correct excess-data handling in ChannelUpdate
2018-08-29 18:01:15 -04:00
Matt Corallo
30b47bbb14
Clean up/clarify channel announcement_signatures handling
2018-08-28 12:56:29 -04:00
Matt Corallo
42e908883f
Return a malformed HTLC message when ephemeral pubkey is garbage
...
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
2018-08-27 11:47:11 -04:00
Matt Corallo
4ca5bcf8cf
Update PendingHTLCStatus to hold malformed HTLC error messages
2018-08-26 16:39:21 -04:00
Matt Corallo
7d6aab7f22
Add update_fail_malformed_htlcs vec to CommitmentUpdate
...
Not sure why this wasn't there to begin with
2018-08-26 16:39:21 -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
32e2f7eef5
Remove unused node_id tracking in ChannelManager tests
2018-08-24 16:58:27 -04:00
Matt Corallo
7ce13da728
Fix integer overflow panic in new HTLC-forwarding fee checks
...
Found by fuzzer
2018-08-23 17:23:46 -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
6e50a84f14
Do not return UpdateFailHTLC updates until the HTLC is committed
...
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.
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
6ab31a0d50
Return channel_updates when failing a HTLC for fee/CLTV reasons
2018-08-23 14:52:43 -04:00
Antoine Riard
05552c0988
Check amt_to_forward and outgoing_cltv_value in add_update_htlc
2018-08-23 14:52:36 -04:00
Matt Corallo
f476a19bde
Add simple utility to ChannelManager to force close all channels
2018-08-20 13:58:31 -04:00
Matt Corallo
42086c94a0
Remove implicit Record import requirement in logging macros
2018-08-20 13:33:09 -04:00
Yuntai Kyong
ada2154b40
Add push_msat to new outbound API
...
Also add APIMisuseError to be thrown to the API client
2018-08-17 13:18:28 -04:00
Matt Corallo
609054eae0
Handle duplicate funding transaction gracefully.
...
This can otherwise cause strange behavior, including a panic on
force_close_all_channels found by full_stack_target fuzzing.
2018-08-16 22:37:44 -04:00
Matt Corallo
b4078d992d
Fix handle_funding_created bug/TODO
...
The fuzzer was able to tickle this
2018-08-16 22:37:41 -04:00
Antoine Riard
0029f04fce
Logging interface
...
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
2018-08-17 00:01:15 +00:00
Antoine Riard
e752611247
Implement HandleError event with ErrorAction field
2018-08-12 00:36:48 +00:00
Matt Corallo
3db5798246
Stub out ChaCha20 non-HMAC encryption/decryption in fuzztarget
2018-08-02 22:37:28 -04:00
Matt Corallo
bd01f4e0c3
Fix fuzztarget ChannelKeys generation
2018-08-02 22:26:44 -04:00
Matt Corallo
cfc3fe3148
Fix panic!() in block_connected on unfunded channels ( fixes #42 )
...
The new full_stack_target fuzzing stuff was able to find this bug,
which gives me a bit of hope for full_stack_target's utility.
2018-08-02 22:26:44 -04:00
Matt Corallo
7e255b5cf5
Handle invalid funding tx in channelmanager
2018-07-29 13:30:04 -04:00