Commit graph

4486 commits

Author SHA1 Message Date
Antoine Riard
cdbd7ce71d Refactor handle_funding_signed to wrapper error handling function 2018-09-07 02:45:07 +00:00
Matt Corallo
5adf125f42 Remove unused import in router_target 2018-09-06 12:39:36 -04:00
Matt Corallo
ed650ec530 Ensure funding_created always returns Some(_) HandleError::action 2018-09-06 11:38:48 -04:00
Matt Corallo
6132a8e648 Merge pull request #154 from ariard/funding_created_refactor
Refactor handle_funding_created to wrapper error handling function
2018-09-06 11:12:10 -04:00
Antoine Riard
e67b715e52 Refactor handle_funding_created to wrapper error handling function 2018-09-06 11:07:44 -04:00
Matt Corallo
0c8d402460 Merge pull request #155 from SWvheerden/patch-1
patch to change temp_channel from deserialise to copy
2018-09-06 10:50:16 -04:00
SW van Heerden
f5e3a3ea81 change temp_channel from deserialise to copy 2018-09-06 10:49:36 -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
60e0ab127c
Merge pull request #152 from TheBlueMatt/2018-09-chan-cleanups
Channel cleanups
2018-09-06 09:51:34 -04:00
Matt Corallo
3f5f3def63 Add further clarification TODO in finish_force_close_channel 2018-09-05 20:32:16 -04:00
Matt Corallo
d1568ca709 Drop HTLCState::LocalRemovedAwaitingCommitment
This was redundant and was included because the HTLC still needed
to be monitored, but that happens in ChannelMonitor, so there is no
need for it in Channel itself.
2018-09-05 19:47:01 -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
eeefdaf7a2 Always return an Error Message in invalid sig/key errors in Channel 2018-09-05 19:46:58 -04:00
Matt Corallo
2a93f98c86
Merge pull request #150 from TheBlueMatt/2018-09-bolt7-compliance
Finish up #129 BOLT 7 compliance
2018-09-05 18:34:10 -04:00
Matt Corallo
74730803a6
Merge pull request #147 from TheBlueMatt/2018-09-channelmanager-err-macro
Refactor ChannelManager handle functions into a Channel-closing macro
2018-09-05 18:33:55 -04:00
Matt Corallo
227c1d21bc Handle partial-response UTXO impls or reorgs in chan_announcements
Mostly to add a big comment noting why we aren't "spec-compliant"
2018-09-04 22:56:25 -04:00
Matt Corallo
3b4c1a3662 Util-func channel removal (fixing a bug in HTLC failure updates) 2018-09-04 22:56:25 -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
7a234b6385 Fill out IgnoreError actions in get_channel_announcement
They are all just "its too early/late to get an announcement"
errors so simply ignoring them and not sending an announce is fine
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
f60b5d971c Ensure Channel::new_from_req always returns an ErrorMessage on Err 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
Matt Corallo
6dfec329ea Provide better get_chain_utxo return coverage in router_target 2018-09-03 17:40:12 -04:00
Matt Corallo
4ee011441b Ensure we aren't duplicatively reading things in router_target 2018-09-03 17:40:12 -04:00
Antoine Riard
88fac35cd4 Add DummyChainWatcher in route_target 2018-09-03 17:40:12 -04:00
Antoine Riard
4b4d8b6b9e Add test_invalid_channel_announcemnt + test utilities
Fix typo
2018-09-03 17:40:12 -04:00
Matt Corallo
187f28db03 Check script_pubkey against expected channel_announcement 2018-09-03 17:40:12 -04:00
Antoine Riard
07ac327f8b Implement get_chain_utxo and ChainError in
ChainWatchInterface to Router check on channel_announcement

Needed for BOLT 7
2018-09-03 17:40:12 -04:00
Antoine Riard
2079fe4ad2 Add ChainWatchInterface in Router 2018-09-03 17:40:05 -04:00
Matt Corallo
1992464316
Merge pull request #144 from yuntai/onion_call_back_simple
Remove code fragments with no effect
2018-09-03 16:51:32 -04:00
Yuntai Kyong
92274c8800 Remove code fragments with no effect 2018-09-02 21:45:44 +09:00
Matt Corallo
a9434db103 Check for misuse of funding_transaction_generated and panic 2018-08-31 17:00:44 -04: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
c91c4be6c5
Merge pull request #139 from TheBlueMatt/2018-08-fuzz-fixes-7
Fix crash that #127 intended to fix but did not completely fix
2018-08-30 16:02:38 -04:00
Matt Corallo
3fbbd9e8d2 Remove unused feeest field in ChannelManager tests 2018-08-30 15:11:16 -04:00
Matt Corallo
794212bb23 Fix crash that #127 intended to fix but did not completely fix
Introduced in #124, and found by fuzzer
2018-08-30 12:37:21 -04:00
Matt Corallo
a1aaea5dc2
Merge pull request #136 from TheBlueMatt/2018-08-excess-signed-data-bolt-7
Correctly verify and forward excess data post-signature in signed announcement messages
2018-08-29 18:43:19 -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
faff5c2da3 Fail parsing node/channel announcements with unknown even features
This is required for BOLT 7 compliance
2018-08-29 18:06:06 -04:00
Matt Corallo
335012640a Update msg_targets with new, must-roundtrip, and hole messages 2018-08-29 18:04:55 -04:00
Matt Corallo
b9a793a0a0 Correct excess-data handling in NodeAnnouncement
Breaks parsing of padding within addresses, but nothing currently
generates such messages, and I'm proposing we remove it in the spec
2018-08-29 18:03:10 -04:00
Matt Corallo
9902fce585 Correct excess-data handling in ChannelUpdate 2018-08-29 18:01:15 -04:00
Matt Corallo
0881bf4b74 Correct excess-data handling in ChannelAnnouncement verif in Router 2018-08-29 17:59:25 -04:00