Commit graph

38 commits

Author SHA1 Message Date
Antoine Riard
c5ee360878 Add block_disconnecting tests to cancel HTLC failure updates
Add test_sweep_outbound_htlc_failure_update
2019-07-17 16:54:21 -04:00
Antoine Riard
273f2fc14a Fail back dust HTLC of local commitment tx after enough confirmations
Add test_failure_delay_htlc_local_commitment and
test_no_failure_dust_htlc_local_commitment

Move some bits of check_spend_remote as we need to fail dust HTLCs
which can be spread on both prev/lastest local commitment tx
2019-07-17 15:26:33 -04:00
Antoine Riard
a2b6a76e59 Delay failure of non-dust HTLC-outputs until solving timeout tx matures
Fix tests broken by introduced change
2019-07-17 15:26:33 -04:00
Antoine Riard
587af43eca Implement block_disconnect for pruning of waiting-conf HTLC updates
Modify ChainListener API by adding height field to block_disconnect
2019-07-17 15:26:33 -04:00
Antoine Riard
72c5423fd5 Track HTLC-failure trigger tx until anti-reorg delay reached
Broadcasting a commitment tx means that we have to fail
inbound HTLC in backward channel. Doing it prematurely would
put us at risk in case of reorg. So we delay passing failure
update upstream until solving tx mature to HTLC_FAIL_ANTI_
REORG_DELAY.
Requirements differ if HTLC is a revoked/non-revoked dust/
non-revoked non-dust one.

Add connect_blocks in test_utils to fix broken tests due to
anti-reorg delay enforcement

Remove anti-duplicate htlc update stuff in ManySimpleChannelMonitor
2019-07-17 15:26:33 -04:00
Antoine Riard
50b6acb696 Add FeeEstimator in ChannelMonitor 2019-04-16 18:50:09 -04:00
Matt Corallo
c86657ea6c Fix inbound channel reserve check for removed-outbound-HTLCs
Found by chanmon_fail_consistency fuzzer.
2019-03-22 17:43:32 -04:00
Tamas Blummer
02b541607b migration to rust-bitcoin 0.17
typedef Sha256dHash with bitcoin_hashes::sha256d::Hash
SecretKey -> PrivateKey.key
assume compressed public keys
2019-03-07 18:50:02 +01:00
Matt Corallo
e354dc28bc Fix uneccessary mut found by 1.22 2019-02-11 12:09:11 -05:00
Philip Robinson
1de117eb2a Explicit tests for update_*_htlc message BOLT2 requirements 2019-02-11 12:09:07 -05:00
Matt Corallo
f99acc6d35
Merge pull request #297 from TheBlueMatt/2019-01-back-fail-privacy
Send back the actual received amount, not expected on HTLC fails
2019-01-25 12:01:44 -05:00
Matt Corallo
bf26056c8a Fix holding cell freeing in case we fail to add some HTLC
Previously, if we went to free the holding cell HTLC updates, and
adding one failed as we hit our outbound HTLC limit (or in-flight
value limit), we would not send a commitment_signed, leaving us in
an invalid state. We first fix that bug, and then refuse to add
things to our holding cell once we reach our limits considering the
holding cell, as we shouldn't have multiple commitment dance rounds
worth of HTLCs in the holding cell anyway.
2019-01-24 21:53:49 -05:00
Matt Corallo
74588b2519 Send back the actual received amount, not expected on HTLC fails
This resolves an incorrect implementation of the spec and fixes a
major privacy leak.

Fixes GH #289.
2019-01-24 16:55:01 -05:00
Dimitris Apostolou
ab10b05075
Fix typos 2019-01-24 19:07:08 +02:00
Matt Corallo
d69fb5f58d Fix indentation in a few new tests 2019-01-23 17:06:38 -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
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
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
12d25576c1 Upgrade to secp256k1 v12, bitcoin v16, and crates bitcoin_hashes 2019-01-22 13:49:15 -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
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
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
e662fa14af Fix stale comment in functional_tests after failing back async 2019-01-05 16:26:20 -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
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
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
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