Commit graph

152 commits

Author SHA1 Message Date
Matt Corallo
9189d0e61d Require at least 1k sat for outbound channels and meet BTC's dust 2018-10-31 15:45:30 -04:00
Matt Corallo
46f573b787 [full_stack_target] don't allow double-confirming txn 2018-10-29 17:16:29 -04:00
Matt Corallo
64bd2eaa7f Give ManyChannelMonitor a logger and trace add_update events 2018-10-29 14:26:05 -04:00
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
47fe673c57 Give ChannelMonitor a logger via new ReadableArgs trait 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
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
5180686b1d Integrate destination_script from KeysInterface in ChannelManager/Channel
Drop channel_monitor_claim_key from ChannelKeys
2018-10-27 09:42:04 -04:00
Antoine Riard
32a9378909 Integrate shutdown_pubkey from KeysInterface in ChannelManager/Channel
Drop channel_close_key from ChannelKeys
2018-10-27 09:42:04 -04:00
Antoine Riard
e361fed0f1 Integrate KeysInterface to ChannelManager with Arc 2018-10-27 09:42:04 -04:00
Yuntai Kyong
f133554697 Add PaymentFailReason for fail_htlc_backwards
to indicate fail reason after a PaymentReceived event
2018-10-25 21:24:53 +09:00
Yuntai Kyong
ba30061c87 Add is_permanent field to ChannelClosed message and add NodeFailure
message
2018-10-23 10:30:49 -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
da6171d50d Remove fuzz channel_target.
It has bitrotted a lot and doesn't really make sense given all the
precondition enforcement that is in channelmanager, sadly.
2018-09-19 22:47:07 -04:00
Matt Corallo
19b92448c5 Utilize Writer size hinting in message fuzz targets and check them 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
Yuntai Kyong
4e4fa56e2b unwrap channel.get_open_channel 2018-09-15 07:33:20 +09:00
Matt Corallo
aa17defa04 Tweak + extend full_stack_target sample to incl HTLC tx broadcasts 2018-09-14 15:27:54 -04:00
Matt Corallo
f27c74b35c
Merge pull request #167 from TheBlueMatt/2018-09-dup-htlc
Allow duplicate-payment_hash HTLCs for HTLC forwards
2018-09-12 13:07:13 -04:00
Matt Corallo
da5d707f49 Allow duplicate-payment_hash HTLCs for HTLC forwards
This is required by BOLT 2 to ensure that no attacker can simply
relay every public node a duplicate-payment_hash HTLC for each HTLC
it receives to deduce where an HTLC came from.

Note that this makes the claim logic much less incentive-compatible
as we will not claim all available HTLCs with the same payment_hash
even if we know the preimage! This is OK because, most likely, any
attackers trying to map the network will use small-value payments
and, hopefully, we will move away from constant hashes across an
entire payment at some point in the near future.

This further simplifies the payment transition state a bit, so
hopefully at least we got some readability out of all of this
2018-09-12 11:15:47 -04:00
Yuntai Kyong
28a612f9f3 Migrate fuzz router/channel target to Readable
and be more specific about DecodeError::InvalidValue
2018-09-12 10:19:36 -04:00
Yuntai Kyong
63cb37d346 Add fuzz targets for Writeable messages/migrate fuzz test 2018-09-12 10:19:36 -04:00
Yuntai Kyong
1b8504a3f3 Implement Writer/Reader
with additional variants in DecodeError
2018-09-12 10:18:02 -04:00
Matt Corallo
673912e769 Add force_close_channel call command to full_stack_target 2018-09-09 11:36:00 -04:00
Matt Corallo
90b545ffe3 Narrow ChainWatchInterface::install_watch_script 2018-09-08 02:30:28 +00:00
Matt Corallo
5adf125f42 Remove unused import in router_target 2018-09-06 12:39:36 -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
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
2079fe4ad2 Add ChainWatchInterface in Router 2018-09-03 17:40:05 -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
a34e80f4e9 Remove incorrect auto-generated header from error_message_target 2018-08-27 11:47:11 -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
755b76bf83 Update error deserialization in compliance with BOLT #1 2018-08-25 17:21:09 -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
0647cf4bf1 Restore push_msat in full_stack_target 2018-08-23 16:11:20 -04:00
Matt Corallo
a1bd563456 Restore full_stack_target fuzzer 2018-08-23 16:11:12 -04:00
Matt Corallo
11e5975523 Update to rust-secp256k1 v0.11 and rust-bitcoin v0.14 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
06d3b4babe Add a full_stack_target sample test to avoid unintentional breakage 2018-08-20 13:58:31 -04:00
Matt Corallo
87aabff8ab Disable push_msat in full_stack_target temporarily 2018-08-20 13:58:31 -04:00
Matt Corallo
1b8f4acb27 Upgrade AFL to 0.4 with persistent mode fuzzing 2018-08-20 13:58:31 -04:00
Matt Corallo
9f2c67ae60 Expand full_stack_target somewhat 2018-08-20 13:58:31 -04:00