Commit graph

817 commits

Author SHA1 Message Date
Matt Corallo
1bc190c760 Drop pending outbound messages on peer disconnection
This shouldn't be required, but it may help prevent some downstream
race conditions due to clients not sending message events quickly
enough and trying to send stale messages before new
channel_reestablish messages.
2019-01-24 13:16:59 -05:00
Matt Corallo
a138a9af01 Handle monitor update failures in two more places
Best reviewed with -b
2019-01-24 13:16:59 -05:00
Matt Corallo
a6f0281017
Merge pull request #288 from TheBlueMatt/2019-01-test-split-raa-flag-fix
Fix several more monitor-update-failed cases
2019-01-24 13:16:33 -05:00
Matt Corallo
d7ac68701f
Merge pull request #301 from rex4539/fix-typos
Fix typos
2019-01-24 13:12:28 -05:00
Dimitris Apostolou
ab10b05075
Fix typos 2019-01-24 19:07:08 +02:00
Matt Corallo
658e558fd0 Fix responding to RAAs when monitor updating had already failed 2019-01-23 17:51:46 -05:00
Matt Corallo
98f264372e Remove incorrect debug_assert!() from reestablish handling and test 2019-01-23 17:43:45 -05:00
Matt Corallo
3e3b2a3be7 Add a test for the ordering setting in channel_reestablish handling 2019-01-23 17:43:45 -05:00
Matt Corallo
985688852b Fix AwaitingRAA on RAA receipt when monitor updating had failed
This fixes a rather subtle case handling RAAs when we don't
generate a response due to a previous monitor update failure, but
would otherwise send a CS response. We need to still set
AwaitingRemoteRevoke on the channl in question, but previously did
not. Found by chanmon_fail_consistency fuzz test with the failing
test converted and added manually.
2019-01-23 17:43:45 -05:00
Matt Corallo
e79b98ddda
Merge pull request #300 from TheBlueMatt/2019-01-tests-split
Split up functional_tests into three separate files
2019-01-23 17:43:13 -05:00
Matt Corallo
d69fb5f58d Fix indentation in a few new tests 2019-01-23 17:06:38 -05:00
Matt Corallo
baa7433504 Fix spelling in do_test_monitor_temporary_update_fail comment 2019-01-23 16:54:53 -05:00
Matt Corallo
aa8ecfed7b Split up monitor-update-failed tests and other functional tests 2019-01-23 16:54:01 -05:00
Matt Corallo
8d9eb973cc Split up functional_tests into utils and the tests themselves 2019-01-23 16:46:44 -05:00
Matt Corallo
efcfb93ebe
Merge pull request #299 from TheBlueMatt/2019-01-262-redux
Added tests to check the bolt 2 specs for open_channel (Sending Node)
2019-01-23 16:15:09 -05:00
Yuko Roodt
4d77e9d752 Added tests to check the bolt 2 specs for Sending Node Channel 2019-01-23 14:54:10 -05:00
Matt Corallo
7a77c9f1d2
Merge pull request #298 from TheBlueMatt/2019-01-271-cleanup
Implement serialize/deserialize for Router
2019-01-23 14:48:13 -05:00
Antoine Riard
c7b8c312ce Implement serialize/deserialize for Router.
Extend route_test to check if serialize/deserialize of
NetworkMap works.

Add PartialEq traits on some Router's structs.

Modify also UnsignedNodeAnnouncement serialization
2019-01-23 11:31:37 -05:00
Antoine Riard
70d06b4610 Implement Writeable/Readable for Option<T>
Add OptionalField in OpenChannel, AcceptChannel
ChannelReestablish to avoid serialization implementation
conflicts
2019-01-23 11:31:26 -05:00
Matt Corallo
4a4cdc1f2a
Merge pull request #286 from TheBlueMatt/2019-01-monitor-update-fixes
Fix a few monitor-update failure bugs found by new fuzzer
2019-01-22 15:27:23 -05:00
Matt Corallo
be8213b244 Fix handling RAA when a monitor update previously failed 2019-01-22 14:38:56 -05:00
Matt Corallo
4cceb58f91 Rewrite monitor_update_failed as it didn't capture all the options
Primarily this fixes the case where we receive an RAA which does
not require a response, allowing us to call monitor_update_failed
without generating pending messages.
2019-01-22 14:34:18 -05:00
Matt Corallo
1633c1f8f8 Remove unused argument from handle_error! 2019-01-22 14:34:18 -05:00
Matt Corallo
4cc7d5d527
Merge pull request #294 from TheBlueMatt/2019-01-deps-bump
Upgrade to secp256k1 v12, bitcoin v16, and crates bitcoin_hashes
2019-01-22 14:32:24 -05:00
Matt Corallo
8678bda576 Ensure Message always unwraps in fuzztarget
Hashes cant be all-0s, so we can normally unwrap, but fuzztarget
can generate all-0 hashes, so we have to handle it and swap for
something else.
2019-01-22 13:49:15 -05:00
Matt Corallo
f109d13e22 Drop verification context from keys manager 2019-01-22 13:49:15 -05:00
Matt Corallo
12d25576c1 Upgrade to secp256k1 v12, bitcoin v16, and crates bitcoin_hashes 2019-01-22 13:49:15 -05:00
Matt Corallo
8ce8fbe925
Merge pull request #203 from TheBlueMatt/2018-10-router-htlc-min
Fix Router min HTLC comparison
2019-01-22 13:48:31 -05:00
Matt Corallo
046e0ca47b
Merge pull request #296 from TheBlueMatt/2019-01-291-rebased
Wrote test to explicitly test BOLT 2 requirements for update_add_htlc
2019-01-22 13:16:45 -05:00
Matt Corallo
4f4a5c06d2 Fix Router min HTLC comparison 2019-01-22 12:22:40 -05:00
Philip Robinson
a48fb848d9 Wrote test to explicitly test BOLT 2 requirements for update_add_htlc
(minor tweaks by @TheBlueMatt)
2019-01-22 12:22:14 -05:00
Matt Corallo
7fd294db3d
Merge pull request #285 from TheBlueMatt/2019-01-fuzz-cleanups
Trivial cleanups in full_stack_target/fuzztarget
2019-01-16 10:11:32 -05:00
Matt Corallo
301f91e2a2
Merge pull request #284 from TheBlueMatt/2019-01-remote-htlc-timeout-broadcast
Check for timing-out HTLCs in remote unrevoked commitments
2019-01-13 13:55:26 -05:00
Matt Corallo
f065a62d40 Fix comment spelling and clarify algebra a bit. 2019-01-13 13:12:04 -05:00
Matt Corallo
d8707c2b20 Check for timing-out HTLCs in remote unrevoked commitments
This resolves a TODO/issue in would_broadcast_at_height where we
will not fail a channel with HTLCs which time out in remote
broadcastable transactions.
2019-01-13 12:59:19 -05:00
Matt Corallo
78939a7e03 Test for failing channel after local commitment dust HTLC timeout 2019-01-13 12:59:19 -05:00
Matt Corallo
92424ebbfe Merge tracking of HTLCs-in-commitment with outbound-HTLCs
This simplifies a few things, deduplicates a some small memory
overhead, and, most importantly, is a first step to fixing
would_broadcast_at_height.
2019-01-13 12:59:19 -05:00
Matt Corallo
09919d2af0 Make HTLCOutputInCommitment::transaction_output_index an Option
We really shouldn't have split out the with-source HTLCs from the
in-transaction HTLCs when we added back-failing, and will need
almost all of the info in HTLCOutputInCommitment for each HTLC to
fix would_broadcast_at_height, so this is a first step at
recombining them.
2019-01-11 16:03:40 -05:00
Matt Corallo
a604cb6763
Merge pull request #283 from TheBlueMatt/2019-01-htlc-resolution-log
Simplify and expand logging in is_resolving_htlc_output
2019-01-08 23:38:38 -05:00
Matt Corallo
292ab5ea61
Merge pull request #282 from TheBlueMatt/2019-01-multi-htlc-claims
Fix multi-remote-HTLC-claim preimage learning
2019-01-08 23:17:37 -05:00
Matt Corallo
90ce97198c Simplify and expand logging in is_resolving_htlc_output
This clarifies all the conditions we can hit and also ensures they
are all logged in a clear and consistent manner.
2019-01-08 23:03:07 -05:00
Matt Corallo
c9df4bd011 Fix multi-remote-HTLC-claim preimage learning
When our counterparty claims multiple HTLCs from offered outputs in
one transaction we should still be able to learn the preimages.
Sadly, due to two bugs we were not previously doing so.
2019-01-08 22:47:23 -05:00
Matt Corallo
bf96c809a5 Fix source name in is_resolving_htlc_output 2019-01-08 22:47:23 -05:00
Matt Corallo
d2ae344799 Fix dead_code warnings in fuzztarget builds 2019-01-08 14:04:06 -05:00
Matt Corallo
5801d19a69 Switch to bitcoin_hashes Hash160 in full_stack_target 2019-01-08 14:04:06 -05:00
Matt Corallo
d8dcb1a9d3 Add doc to full_stack_target 2019-01-08 14:04:06 -05:00
Matt Corallo
cdf9b4f8ba Add option to use libfuzzer sys in full_stack_target
Note that there doesn't appear to be a way to conditionally set
 #[no_main] so that has to happen manually at compile-time.
2019-01-08 14:04:06 -05:00
Matt Corallo
a5bcd5651d
Merge pull request #280 from TheBlueMatt/2018-12-no-to-remote-revoked-htlcs
Move fail-backwards up for no to-remote output claims
2019-01-05 17:07:40 -05:00
Matt Corallo
e662fa14af Fix stale comment in functional_tests after failing back async 2019-01-05 16:26:20 -05:00
Matt Corallo
913d56ecab Macro-DRY HTLC back-fails for revoked remote transaction broadcast 2019-01-05 16:24:50 -05:00