Matt Corallo
a2d4889e32
panic on invalid calls to Channel::send_commitment instead of Err
2018-09-09 11:36:00 -04:00
Matt Corallo
33fa278f33
Do not allow sending HTLCs when the first hop is disconnected
2018-09-09 11:36:00 -04:00
Matt Corallo
8cad2ffa9b
Sync get_update_fail_htlc, get_update_fulfill_htlc state err result
...
Both get_update_fail_htlc and get_update_fulfill_htlc should never
be called before any HTLC could have been accepted (ie
pre-ChannelFunded) nor should they ever be called
post-ShutdownComplete as the Channel object should be destroyed at
that point. Previously get_update_fulfill_htlc would panic, but
get_update_fail_htlc would return an Err. For now make them both
panic but we can revisit this if we want to have fewer panics in
the future.
2018-09-09 11:36:00 -04:00
Matt Corallo
e9fed4973b
Disallow duplicate Init messages from peers
2018-09-08 14:43:42 -04:00
Matt Corallo
bf46a5f721
Fix PeerManager::get_peer_node_ids to filter according to docs
2018-09-08 13:59:39 -04:00
Matt Corallo
6dab6b185d
Disconnect duplicate node_id connections after Noise handshake
2018-09-08 13:59:39 -04:00
Matt Corallo
c2bbeb5814
Update add_update_monitor docs to indicate registration req.
...
It wasn't entirely clear from the existing docs that it is the
responsibility of the implementor of ManyChannelMonitor to
register the relevant outpoint.
2018-09-08 10:33:32 -04:00
Matt Corallo
beee006365
Document Channel::get_funding_redeemscript precondition
2018-09-08 10:30:10 -04:00
Antoine Riard
4b9adea006
Add registration of commitment tx's outputs from
...
check_spend_remote_transaction
Fixup more descriptive var names by Matt Corallo <git@bluematt.me>
2018-09-08 02:30:28 +00:00
Matt Corallo
bfb9b46fb2
Refactor/dont re-enter block_conencted on duplicate watch calls
...
Previously we'd hit an infinite loop if a block_connected call
always resulted in the same ChainWatchInterface registrations.
While we're at it, we also split ChainWatchUtil in two to make
things a bit more flexible for users, though not sure if that
actually matters, and make the matching more aggressive in testing,
even if we pick the more performant option at runtime.
2018-09-08 02:30:28 +00:00
Matt Corallo
90b545ffe3
Narrow ChainWatchInterface::install_watch_script
2018-09-08 02:30:28 +00:00
Antoine Riard
f1a26e6aea
Refactor handle_update_fee to wrapper error handling function
2018-09-07 21:59:45 +00:00
Antoine Riard
d6726d6f26
Refactor handle_revoke_and_ack to wrapper error handling function
2018-09-07 21:57:06 +00:00
Antoine Riard
88e561be85
Refactor handle_commitment_signed to wrapper error handling function
2018-09-07 21:51:58 +00:00
Antoine Riard
5662edaf9f
Refactor handle_update_fail_malformed_htlc to wrapper error handling function
2018-09-07 21:46:47 +00:00
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
Matt Corallo
6016ca1870
Merge pull request #160 from ariard/channel_manager_refactor_all
...
Channel manager refactor all
2018-09-07 10:19:28 -04: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
Matt Corallo
ed650ec530
Ensure funding_created always returns Some(_) HandleError::action
2018-09-06 11:38:48 -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
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
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
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
Yuntai Kyong
92274c8800
Remove code fragments with no effect
2018-09-02 21:45:44 +09:00