Commit graph

920 commits

Author SHA1 Message Date
Matt Corallo
a383f64e86
Merge pull request #328 from dongcarl/fine
Add test for tie breaking when sorting outputs
2019-04-03 16:27:56 -04:00
Matt Corallo
f5a572926f
Merge pull request #329 from dongcarl/patch-1
Improve README usability
2019-03-26 11:58:55 -04:00
Matt Corallo
475bee2bb7
Merge pull request #326 from TheBlueMatt/2019-03-temp-failure-use-cases
Update docs for TemporaryFailure to note other use-cases
2019-03-25 18:36:25 -04:00
Carl Dong
a58e2ba098
Improve README usability 2019-03-25 18:03:06 -04:00
Carl Dong
4db0d6ed16 Add test for tie breaking when sorting outputs 2019-03-25 17:39:22 -04:00
Matt Corallo
b031bdf9d8 Update docs for TemporaryFailure to note other use-cases 2019-03-25 17:27:04 -04:00
Matt Corallo
91dc91f053
Merge pull request #325 from TheBlueMatt/2019-03-322-cleanup
Extract preimage from revoked HTLC-Success to claim backward
2019-03-25 17:12:00 -04:00
Matt Corallo
c2a3fc74dc Fix crash in chanmon_fail_consistency due to fuzz hash collisions 2019-03-25 17:03:53 -04:00
Matt Corallo
50e16c9573 Rewrite Channel resend tracking to make it much more reliable
Resending revoke_and_ack and commitment_signed (+update) messages
after monitor-update-failure or disconnection has been a highly
unreliable part of our codebase for some time (as evidenced by the
number of bugs caught in the chanmon_fail_consistency fuzz target).
This is due to its rather ad-hoc nature and tracking/behavior which
consists of checking a number of different flags to try to deduce
which messages were/were not delivered and go from there. Instead,
this commit rewrites it to simply keep track of the order messages
were generated originally, as we always resend in the
originally-generated order.

I'm anticipating this will be way more robust than the old code, in
addition to its simplicity.
2019-03-25 17:03:53 -04:00
Matt Corallo
63ed8fe576 Add log_trace on completion of monitor update restoration in Chan 2019-03-25 16:43:26 -04:00
Antoine Riard
3cc7666c5a Extract preimage from revoked HTLC-Success to claim backward
Tweaks by Matt Corallo <git@bluematt.me>
2019-03-25 16:39:48 -04:00
Matt Corallo
d22650c0cf
Merge pull request #319 from TheBlueMatt/2019-03-htlc-sorting
Fix HTLC-output-in-commitment sorting for duplicate-HTLCs
2019-03-25 13:26:31 -04:00
Matt Corallo
8b4cb9fadb
Merge pull request #316 from TheBlueMatt/2019-03-removed-reserve-check
Fix remote reserve check with inbound claims-in-flight
2019-03-25 12:47:42 -04:00
Matt Corallo
054530cfb9 Fix potential overflow bug introduced in channel reserve check fix
Found by chanmon_fail_consistency fuzz test.
2019-03-22 17:43:32 -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
Matt Corallo
558f8da900 Add macro for PaymentSent event checking in test_utils 2019-03-22 17:19:38 -04:00
Matt Corallo
bb094f1e30
Merge pull request #314 from TheBlueMatt/2019-03-chan-cleanup
Two simple Channel cleanups
2019-03-22 17:16:08 -04:00
Matt Corallo
a0854884ca Remove unused BIP69 input sorting
Lightning doesn't (currently) do any input sorting at the protocol
level, but if we ever need to re-add this its in git history.
2019-03-07 13:56:06 -05:00
Matt Corallo
d990f72f9a Fix HTLC-output-in-commitment sorting for duplicate-HTLCs
This resolves both an issue that hits fuzzing due to hash
collisions as well as implements an update to the BOLT spec.
2019-03-07 13:56:01 -05:00
Matt Corallo
35853a607d
Merge pull request #318 from tamasblummer/rbitcoin017
migration to rust-bitcoin 0.17
2019-03-07 13:31:02 -05: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
8d9b1af8c3 Add a useful log_trace before we release holding cell. 2019-03-03 14:23:52 -05:00
Matt Corallo
29ed3e227f Move fail_reason into OutboundHTLCState states
This should probably have happened when we moved most state into
the state enums themselves, but specifically forcing awareness of
the removed/not removed state would have prevented me from
introducing a bug in the first version of an upcoming reserve-value
patch.
2019-03-03 14:23:52 -05:00
Matt Corallo
fef2ebab91
Merge pull request #313 from ariard/2019-02-clarify-test-full-stack-target
Clarify a bit full_stack_target test_no_existing_test_breakage
2019-03-01 17:38:23 -05:00
Matt Corallo
235cf03073
Merge pull request #292 from ariard/2019-12-serialization-test
[Ready for Review] Add msgs serialization tests
2019-03-01 17:37:17 -05:00
Antoine Riard
6031017351 Clarify a bit full_stack_target test_no_existing_test_breakage 2019-02-27 20:54:52 -05:00
Matt Corallo
591362fdb1
Merge pull request #308 from dongcarl/2019-02-reformulate-unknown-bits-calculation
msgs: Reformulate unknown bits calculation w/ any
2019-02-24 14:27:19 -05:00
Matt Corallo
788bd915c4
Merge pull request #307 from dongcarl/2019-02-derive-partialeq
util: Derive PartialEq for Level
2019-02-24 14:25:58 -05:00
Antoine Riard
c5d730b690 Add bolt1 msgs serialization tests 2019-02-13 20:23:25 -05:00
Antoine Riard
a6cd7def35 Add bolt2 msgs serialization tests 2019-02-13 20:23:25 -05:00
Antoine Riard
d8c2cc2cc4 Add bolt7 msgs serialization tests 2019-02-13 20:23:25 -05:00
Matt Corallo
fd26091d96
Merge pull request #309 from TheBlueMatt/2019-02-306-nits
Explicit tests for update_*_htlc message BOLT2 requirements
2019-02-11 15:17:52 -05: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
Carl Dong
e91b6469f3 msgs: Reformulate unknown bits calculation w/ any 2019-02-07 13:16:17 -05:00
Carl Dong
abe3fa1a40 util: Derive PartialEq for Level
PartialEq, Eq, and Hash should all be derived together wherever possible
to not violate Hash invariants. See the documentation for
std:#️⃣:Hash for more details.
2019-02-07 13:08:21 -05:00
Matt Corallo
5764634568
Merge pull request #304 from TheBlueMatt/2019-01-bump-08
Bump version to 0.0.8
2019-01-25 13:09:38 -05:00
Matt Corallo
2950ffe54e
Merge pull request #303 from TheBlueMatt/2019-01-log-more
Add a bunch of additional logging
2019-01-25 13:09:05 -05:00
Matt Corallo
cfcecdbf11 Bump version to 0.0.8 2019-01-25 12:07:16 -05:00
Matt Corallo
5f4bb593b8 Log information about channel freeze/restore from monitor updates 2019-01-25 12:04:39 -05:00
Matt Corallo
e5fa4f270a log_trace HTLC changes in Channel::get_update_fulfill_htlc 2019-01-25 12:04:39 -05:00
Matt Corallo
f0bcb7dba0 log_trace HTLC transitions in RAA handling (best reviewed with -b) 2019-01-25 12:04:39 -05:00
Matt Corallo
b2252fb1e4 log_trace information about commitment txn as they're being built 2019-01-25 12:04:39 -05:00
Matt Corallo
8845d53b33
Merge pull request #302 from TheBlueMatt/2019-01-hashes03
Bump bitcoin_hashes to 0.3
2019-01-25 12:02:02 -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
4ccb1e4932
Merge pull request #290 from TheBlueMatt/2019-01-monitor-update-handle-fuzz
Handle monitor update failures in two more places + new fuzz test
2019-01-25 12:01:19 -05:00
Matt Corallo
db07d6e30e Bump bitcoin_hashes to 0.3 2019-01-24 22:29:10 -05:00
Matt Corallo
3117e1812b
Merge pull request #295 from TheBlueMatt/2019-01-holding-cell-limits
Fix holding cell freeing in case we fail to add some HTLC
2019-01-24 22:27:52 -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