Commit graph

783 commits

Author SHA1 Message Date
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
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
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
Matt Corallo
e344b0a8fe Add test_commitment_revoked_fail_backward_exhaustive no_to_remote
This tests a case we previously didn't handle correctly where we
returned early if there was no to_remote output to claim and thus
failed to fail-backwards HTLCs which were present.
2019-01-05 16:24:50 -05:00
Matt Corallo
dbbf4914ea Add dust mode to test_commitment_revoked_fail_backward_exhaustive
This tests that we fail back HTLCs that don't make it into
commitment transactions the same as we test ones that do.
2019-01-05 16:24:50 -05:00
Matt Corallo
0faf7bb094
Merge pull request #281 from ariard/harden-inbound-htlc-resolved
Harden test for logging of inbound htlc being resolved
2019-01-04 23:07:29 -05:00
Antoine Riard
cb53ae76f3 Log resolution of offered HTLC by HTLC-timeout tx 2019-01-02 21:06:04 -05:00
Matt Corallo
24577344fa Move fail-backwards up for no to-remote output claims
This fixes HTLC fail-backwards in case we haven't yet sent enough
to have a to_remote output to claim, plus some edge cases where it
could be removed due to a fee update, though hopefully that goes
away with simplified_commitment.
2018-12-31 20:26:07 -05:00
Matt Corallo
13dc1db100
Merge pull request #278 from TheBlueMatt/2018-12-fail-on-unrevoked-remote
Fail HTLC backwards on unrevoked remote commitment tx broadcast
2018-12-31 20:25:44 -05:00
Antoine Riard
93fd3e8bb9 More comments/hardening test_fail_backwards_unrevoked_remote_announce 2018-12-31 19:56:32 -05:00
Matt Corallo
608cf1c89d Fail HTLC backwards on unrevoked remote commitment tx broadcast 2018-12-31 19:56:32 -05:00
Matt Corallo
726674ddb5 Macro-out BroadcastChannelUpdate-on-channel-close in func tests 2018-12-22 07:03:17 -05:00
Matt Corallo
36954fde6e Log errors forwarding/failing HTLCs 2018-12-22 07:03:17 -05:00
Matt Corallo
ce08061518 Remove long-stale TODO 2018-12-22 07:03:17 -05:00
Matt Corallo
eb933d90f3
Merge pull request #276 from TheBlueMatt/2018-12-async-fail
Fail HTLCs backwards asynchronously
2018-12-22 07:02:41 -05:00
Matt Corallo
044edd6e86 Fail HTLCs backwards asynchronously 2018-12-21 15:17:42 -05:00
Matt Corallo
c220a5c5cf Add an enum option to pending forwards to fail backwards 2018-12-20 22:56:32 -05:00
Matt Corallo
e5c1716f5c Refactor HTLCForwardInfo into an enum in prep for delayed-fail 2018-12-20 22:56:32 -05:00
Matt Corallo
4aa814d53c macro-out a bunch of PendingHTLCsForwardable+forward calls 2018-12-20 22:56:32 -05:00
Matt Corallo
04ff26efa9 Move process_onion_failure into onion_utils 2018-12-20 22:56:32 -05:00
Matt Corallo
3bfea5b659
Merge pull request #275 from TheBlueMatt/2018-12-manager-split
Split up ChannelManager
2018-12-20 14:59:22 -05:00
Matt Corallo
28e2480c6e Drop needless mut found by rustc 1.22 2018-12-20 14:32:02 -05:00
Matt Corallo
2053edbe53 Move ChannelManager network tests into their own module 2018-12-20 14:32:02 -05:00
Matt Corallo
dcaa53d560 Move onion encryption/decryption/etc into an onion_utils module 2018-12-19 20:36:34 -05:00
Matt Corallo
6cf8158519 Drop channel_held_info which was only for the channel fuzz target 2018-12-19 20:36:34 -05:00
Matt Corallo
50ed320503
Merge pull request #270 from TheBlueMatt/2018-12-drop-rust-crypto
Drop rust-crypto for bitcoin_hashes
2018-12-19 20:35:46 -05:00
Matt Corallo
f5dc762754 trace_log more in channelmonitor 2018-12-19 20:02:36 -05:00
Matt Corallo
7ea39a13b2 Use bitcoin_hashes' fixed_time_eq, removing the rust-crypto dep 2018-12-19 20:02:36 -05:00
Matt Corallo
202c0aedcb Drop rust-crypto trait usage 2018-12-19 20:02:36 -05:00
Matt Corallo
7511a82195 Steal rust-crypto's Poly1305 implementation wholesale 2018-12-19 20:02:36 -05:00
Matt Corallo
09c7f2f641 Steal rust-crypto's ChaCha20 implementation wholesale 2018-12-19 20:02:36 -05:00
Matt Corallo
8e07259326 Use bitcoin_hashes' Ripemd160/Hash160 from rust-crypto+rust-bitcoin
Note that this requires rewriting full_stack_target tests, which
sucks, but it does let the fuzzer hit more stuff since the real
ripemd160 isn't ever actually called anymore.
2018-12-19 20:02:36 -05:00
Matt Corallo
f1e400f142 Switch Sha256 to using bitcoin_hashes and our own HKDF 2018-12-19 17:13:25 -05:00
Matt Corallo
f904690b00 Change the way channel keys are generated
This fixes a somewhat-misuse of HKDF in ChannelKeys::new_from_seed,
but much more importantly removes a use of rust-crypto's HKDF funcs
2018-12-17 23:55:38 -05:00
Matt Corallo
ec513b81df
Merge pull request #274 from TheBlueMatt/2018-12-243-review
Onion Error Handling
2018-12-17 23:33:22 -05:00
Matt Corallo
caeff85368 Update incorrect_payment_amount generation/handling for BOLT uptd
ie dont generate them as they're a really obvious privacy leak.
Luckily we were already handling them the same aside from log
printing so don't have to touch anything there. I was lazy in
updating tests but it only effects log printing, so whatever.
2018-12-17 22:57:47 -05:00
Yuntai Kyong
3f4ab940d4 Add tests for process_onion_failure return value sanity 2018-12-17 22:55:45 -05:00