Yuntai Kyong
7dc215edcb
Make my_current_per_commitment_point Option
...
Per Bolt #2 , both your_last_per_commitment_secret &
my_current_per_commitment_point are optional depending on
`data_loss_protect`
2018-08-29 12:55:11 +09:00
Matt Corallo
765987759a
Merge pull request #132 from TheBlueMatt/2018-08-bolt-4-spec-return-fail
...
Return a malformed HTLC message when ephemeral pubkey is garbage
2018-08-27 12:44:13 -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
4ca5bcf8cf
Update PendingHTLCStatus to hold malformed HTLC error messages
2018-08-26 16:39:21 -04:00
Matt Corallo
7d6aab7f22
Add update_fail_malformed_htlcs vec to CommitmentUpdate
...
Not sure why this wasn't there to begin with
2018-08-26 16:39:21 -04:00
Matt Corallo
b83443f0cc
Merge pull request #131 from TheBlueMatt/2018-08-bolt-1-compliance
...
update Error/Init handling to be BOLT 1 compliant
2018-08-26 15:37:05 -04:00
Matt Corallo
a33b3a2695
Merge pull request #130 from TheBlueMatt/2018-08-fuzz-fixes-6
...
Fix crash introduced in #124
2018-08-26 15:36:58 -04:00
Matt Corallo
755b76bf83
Update error deserialization in compliance with BOLT #1
2018-08-25 17:21:09 -04:00
Matt Corallo
a3247abb4e
Handle Error messages by closing channels as required by BOLT 1
2018-08-25 17:20:58 -04:00
Matt Corallo
8f36386bee
Ensure we never send messages prior to Init for BOLT 1 compliance
2018-08-25 14:49:18 -04:00
Matt Corallo
32e2f7eef5
Remove unused node_id tracking in ChannelManager tests
2018-08-24 16:58:27 -04:00
Matt Corallo
4f77c812a4
Fix crash introduced in #124
...
I'm rapidly starting to regret holding failed HTLCs in Channel,
given we allow them to violate the no-duplicate-hashes
precondition.
Found by fuzzer
2018-08-24 16:58:27 -04:00
Matt Corallo
a66e597e95
Merge pull request #127 from TheBlueMatt/2018-08-fuzz-fixes-5
...
Fix several panics introduced by #125 (#114 ) and #124
2018-08-23 18:19:40 -04:00
Matt Corallo
7ce13da728
Fix integer overflow panic in new HTLC-forwarding fee checks
...
Found by fuzzer
2018-08-23 17:23:46 -04:00
Matt Corallo
dfc04ad0b4
Fix duplicate payment_hashes one immediately failed, one fail crash
...
Found by fuzzer
2018-08-23 17:04:31 -04:00
Matt Corallo
dbff6010c7
Merge pull request #124 from TheBlueMatt/2018-08-htlc-fail-spec
...
Do not return UpdateFailHTLC updates until the HTLC is committed
2018-08-23 16:44:34 -04:00
Matt Corallo
f5b4759208
Merge pull request #126 from TheBlueMatt/2018-08-restore-full-fuzz
...
Restore full_stack_target fuzzer
2018-08-23 16:41:53 -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
0647cf4bf1
Restore push_msat in full_stack_target
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
a1bd563456
Restore full_stack_target fuzzer
2018-08-23 16:11:12 -04:00
Matt Corallo
7345c0b3ce
Add trace logs for Errs when handling peer messages
2018-08-23 16:11:12 -04:00
Matt Corallo
4330ae5d4f
Merge pull request #123 from TheBlueMatt/2018-08-secp-0.10
...
Update to rust-secp256k1 v0.11 and rust-bitcoin v0.14
2018-08-23 15:29:21 -04:00
Matt Corallo
d0e1e7fead
Merge pull request #125 from TheBlueMatt/2018-08-114-rebase
...
Rebase of #114
2018-08-23 15:29:15 -04:00
Matt Corallo
11e5975523
Update to rust-secp256k1 v0.11 and rust-bitcoin v0.14
2018-08-23 14:52:43 -04:00
Matt Corallo
5ee88ad9f2
Clean up excess \ns in route debug, use all debug encoders
2018-08-23 14:52:43 -04:00
Matt Corallo
6ab31a0d50
Return channel_updates when failing a HTLC for fee/CLTV reasons
2018-08-23 14:52:43 -04:00
Antoine Riard
0523403887
Add Display trait on network structs for routing bug track
2018-08-23 14:52:42 -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
1e118743bd
Merge pull request #111 from TheBlueMatt/2018-08-full-stack-target-upstream-1
...
Expand full_stack_target somewhat
2018-08-20 14:43:33 -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
Matt Corallo
f476a19bde
Add simple utility to ChannelManager to force close all channels
2018-08-20 13:58:31 -04:00
Matt Corallo
7a04595269
Only enforce no-dup-payment_hash precondition on non-removed HTLCs
...
This fixes a panic found by fuzzer.
2018-08-20 13:58:31 -04:00
Matt Corallo
7318a97b15
Merge pull request #122 from TheBlueMatt/2018-08-doc-usability-fixes
...
Simple log usability fix, add some missing docs
2018-08-20 13:57:35 -04:00
Matt Corallo
42086c94a0
Remove implicit Record import requirement in logging macros
2018-08-20 13:33:09 -04:00
Matt Corallo
7743cbdf14
Add APIError docs
2018-08-17 17:36:50 -04:00
Matt Corallo
0f24a67c82
Merge pull request #118 from TheBlueMatt/2018-08-103-rebased
...
Rebase of #103
2018-08-17 14:00:50 -04:00
Matt Corallo
93b470dbb4
Merge pull request #117 from TheBlueMatt/2018-08-no-claim-fuzz-bug
...
Don't HTLC claim with no-possible-preimage in full_stack_target
2018-08-17 13:25:57 -04:00
Matt Corallo
1360fccd71
Ignore unknown channel flags as required in BOLT 2
2018-08-17 13:22:44 -04:00
Yuntai Kyong
69624a8556
add 1% chnnel reserve while keeping min value
...
if 1000 is always used it will almost always fail test reserve < dust_limit check
2018-08-17 13:18:29 -04:00
Yuntai Kyong
1c839ff103
Add checking locally derived reserve and dust limit
2018-08-17 13:18:28 -04:00
Yuntai Kyong
716b37863a
document optional channel constraints per spec
2018-08-17 13:18:28 -04:00
Yuntai Kyong
0fece38b19
Add various checking when handling open and accept
...
Add `derive_minimum_depth()` and `derive_maximum_minimum_depth()` and hide
CONF_TARGET constant behind these functions.
Replace `DisconnectPeer` error with `HandleError` with `ErrorAction::SendErrorMessage`
2018-08-17 13:18:28 -04:00
Yuntai Kyong
ada2154b40
Add push_msat to new outbound API
...
Also add APIMisuseError to be thrown to the API client
2018-08-17 13:18:28 -04:00
Yuntai Kyong
4553369d20
Add APIError enum
...
`APIMisuse` when paramters passed from the client is invalid
`FeeRateTooHigh` when a channel cannot be opened due to high feerate
2018-08-17 13:09:30 -04:00
Matt Corallo
faf9864d9d
Don't HTLC claim with no-possible-preimage in full_stack_target
2018-08-17 12:34:09 -04:00