]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
6 years agoFix test for ChannelReestablish
Yuntai Kyong [Wed, 29 Aug 2018 04:00:34 +0000 (13:00 +0900)]
Fix test for ChannelReestablish

6 years agoMake my_current_per_commitment_point Option
Yuntai Kyong [Wed, 29 Aug 2018 03:55:11 +0000 (12:55 +0900)]
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`

6 years agoMerge pull request #132 from TheBlueMatt/2018-08-bolt-4-spec-return-fail
Matt Corallo [Mon, 27 Aug 2018 16:44:13 +0000 (12:44 -0400)]
Merge pull request #132 from TheBlueMatt/2018-08-bolt-4-spec-return-fail

Return a malformed HTLC message when ephemeral pubkey is garbage

6 years agoRemove incorrect auto-generated header from error_message_target 2018-08-bolt-4-spec-return-fail
Matt Corallo [Mon, 27 Aug 2018 15:46:41 +0000 (11:46 -0400)]
Remove incorrect auto-generated header from error_message_target

6 years agoReturn a malformed HTLC message when ephemeral pubkey is garbage
Matt Corallo [Sun, 26 Aug 2018 20:35:26 +0000 (16:35 -0400)]
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

6 years agoUpdate PendingHTLCStatus to hold malformed HTLC error messages
Matt Corallo [Sun, 26 Aug 2018 20:34:47 +0000 (16:34 -0400)]
Update PendingHTLCStatus to hold malformed HTLC error messages

6 years agoAdd update_fail_malformed_htlcs vec to CommitmentUpdate
Matt Corallo [Sun, 26 Aug 2018 20:30:01 +0000 (16:30 -0400)]
Add update_fail_malformed_htlcs vec to CommitmentUpdate

Not sure why this wasn't there to begin with

6 years agoMerge pull request #131 from TheBlueMatt/2018-08-bolt-1-compliance
Matt Corallo [Sun, 26 Aug 2018 19:37:05 +0000 (15:37 -0400)]
Merge pull request #131 from TheBlueMatt/2018-08-bolt-1-compliance

update Error/Init handling to be BOLT 1 compliant

6 years agoMerge pull request #130 from TheBlueMatt/2018-08-fuzz-fixes-6
Matt Corallo [Sun, 26 Aug 2018 19:36:58 +0000 (15:36 -0400)]
Merge pull request #130 from TheBlueMatt/2018-08-fuzz-fixes-6

 Fix crash introduced in #124

6 years agoUpdate error deserialization in compliance with BOLT #1 2018-08-bolt-1-compliance
Matt Corallo [Sat, 25 Aug 2018 19:03:59 +0000 (15:03 -0400)]
Update error deserialization in compliance with BOLT #1

6 years agoHandle Error messages by closing channels as required by BOLT 1
Matt Corallo [Sat, 25 Aug 2018 18:48:18 +0000 (14:48 -0400)]
Handle Error messages by closing channels as required by BOLT 1

6 years agoEnsure we never send messages prior to Init for BOLT 1 compliance
Matt Corallo [Sat, 25 Aug 2018 18:32:02 +0000 (14:32 -0400)]
Ensure we never send messages prior to Init for BOLT 1 compliance

6 years agoRemove unused node_id tracking in ChannelManager tests 2018-08-fuzz-fixes-6
Matt Corallo [Fri, 24 Aug 2018 20:48:24 +0000 (16:48 -0400)]
Remove unused node_id tracking in ChannelManager tests

6 years agoFix crash introduced in #124
Matt Corallo [Fri, 24 Aug 2018 15:52:55 +0000 (11:52 -0400)]
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

6 years agoMerge pull request #127 from TheBlueMatt/2018-08-fuzz-fixes-5
Matt Corallo [Thu, 23 Aug 2018 22:19:40 +0000 (18:19 -0400)]
Merge pull request #127 from TheBlueMatt/2018-08-fuzz-fixes-5

Fix several panics introduced by #125 (#114) and #124

6 years agoFix integer overflow panic in new HTLC-forwarding fee checks 2018-08-fuzz-fixes-5
Matt Corallo [Thu, 23 Aug 2018 21:23:13 +0000 (17:23 -0400)]
Fix integer overflow panic in new HTLC-forwarding fee checks

Found by fuzzer

6 years agoFix duplicate payment_hashes one immediately failed, one fail crash
Matt Corallo [Thu, 23 Aug 2018 21:02:29 +0000 (17:02 -0400)]
Fix duplicate payment_hashes one immediately failed, one fail crash

Found by fuzzer

6 years agoMerge pull request #124 from TheBlueMatt/2018-08-htlc-fail-spec
Matt Corallo [Thu, 23 Aug 2018 20:44:34 +0000 (16:44 -0400)]
Merge pull request #124 from TheBlueMatt/2018-08-htlc-fail-spec

Do not return UpdateFailHTLC updates until the HTLC is committed

6 years agoMerge pull request #126 from TheBlueMatt/2018-08-restore-full-fuzz
Matt Corallo [Thu, 23 Aug 2018 20:41:53 +0000 (16:41 -0400)]
Merge pull request #126 from TheBlueMatt/2018-08-restore-full-fuzz

Restore full_stack_target fuzzer

6 years agoMerge HTLC-update events, remove FailHTLC ErrorAction 2018-08-htlc-fail-spec
Matt Corallo [Wed, 22 Aug 2018 16:09:11 +0000 (12:09 -0400)]
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.

6 years agoRestore push_msat in full_stack_target 2018-08-restore-full-fuzz
Matt Corallo [Thu, 23 Aug 2018 19:58:59 +0000 (15:58 -0400)]
Restore push_msat in full_stack_target

6 years agoDo not return UpdateFailHTLC updates until the HTLC is committed
Matt Corallo [Tue, 21 Aug 2018 20:57:41 +0000 (16:57 -0400)]
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.

6 years agoRestore full_stack_target fuzzer
Matt Corallo [Thu, 23 Aug 2018 18:33:44 +0000 (14:33 -0400)]
Restore full_stack_target fuzzer

6 years agoAdd trace logs for Errs when handling peer messages
Matt Corallo [Thu, 23 Aug 2018 20:05:57 +0000 (16:05 -0400)]
Add trace logs for Errs when handling peer messages

6 years agoMerge pull request #123 from TheBlueMatt/2018-08-secp-0.10
Matt Corallo [Thu, 23 Aug 2018 19:29:21 +0000 (15:29 -0400)]
Merge pull request #123 from TheBlueMatt/2018-08-secp-0.10

Update to rust-secp256k1 v0.11 and rust-bitcoin v0.14

6 years agoMerge pull request #125 from TheBlueMatt/2018-08-114-rebase
Matt Corallo [Thu, 23 Aug 2018 19:29:15 +0000 (15:29 -0400)]
Merge pull request #125 from TheBlueMatt/2018-08-114-rebase

Rebase of #114

6 years agoUpdate to rust-secp256k1 v0.11 and rust-bitcoin v0.14 2018-08-secp-0.10
Matt Corallo [Mon, 20 Aug 2018 21:13:07 +0000 (17:13 -0400)]
Update to rust-secp256k1 v0.11 and rust-bitcoin v0.14

6 years agoClean up excess \ns in route debug, use all debug encoders 2018-08-114-rebase
Matt Corallo [Thu, 23 Aug 2018 18:17:02 +0000 (14:17 -0400)]
Clean up excess \ns in route debug, use all debug encoders

6 years agoReturn channel_updates when failing a HTLC for fee/CLTV reasons
Matt Corallo [Thu, 23 Aug 2018 17:54:34 +0000 (13:54 -0400)]
Return channel_updates when failing a HTLC for fee/CLTV reasons

6 years agoAdd Display trait on network structs for routing bug track
Antoine Riard [Thu, 23 Aug 2018 17:23:00 +0000 (13:23 -0400)]
Add Display trait on network structs for routing bug track

6 years agoCheck amt_to_forward and outgoing_cltv_value in add_update_htlc
Antoine Riard [Thu, 23 Aug 2018 17:22:18 +0000 (13:22 -0400)]
Check amt_to_forward and outgoing_cltv_value in add_update_htlc

6 years agoMerge pull request #111 from TheBlueMatt/2018-08-full-stack-target-upstream-1
Matt Corallo [Mon, 20 Aug 2018 18:43:33 +0000 (14:43 -0400)]
Merge pull request #111 from TheBlueMatt/2018-08-full-stack-target-upstream-1

 Expand full_stack_target somewhat

6 years agoAdd a full_stack_target sample test to avoid unintentional breakage 2018-08-full-stack-target-upstream-1
Matt Corallo [Tue, 14 Aug 2018 13:55:38 +0000 (09:55 -0400)]
Add a full_stack_target sample test to avoid unintentional breakage

6 years agoDisable push_msat in full_stack_target temporarily
Matt Corallo [Fri, 17 Aug 2018 21:36:22 +0000 (17:36 -0400)]
Disable push_msat in full_stack_target temporarily

6 years agoUpgrade AFL to 0.4 with persistent mode fuzzing
Matt Corallo [Thu, 16 Aug 2018 18:20:34 +0000 (14:20 -0400)]
Upgrade AFL to 0.4 with persistent mode fuzzing

6 years agoExpand full_stack_target somewhat
Matt Corallo [Fri, 17 Aug 2018 21:38:43 +0000 (17:38 -0400)]
Expand full_stack_target somewhat

6 years agoAdd simple utility to ChannelManager to force close all channels
Matt Corallo [Tue, 14 Aug 2018 14:43:34 +0000 (10:43 -0400)]
Add simple utility to ChannelManager to force close all channels

6 years agoOnly enforce no-dup-payment_hash precondition on non-removed HTLCs
Matt Corallo [Mon, 20 Aug 2018 14:33:30 +0000 (10:33 -0400)]
Only enforce no-dup-payment_hash precondition on non-removed HTLCs

This fixes a panic found by fuzzer.

6 years agoMerge pull request #122 from TheBlueMatt/2018-08-doc-usability-fixes
Matt Corallo [Mon, 20 Aug 2018 17:57:35 +0000 (13:57 -0400)]
Merge pull request #122 from TheBlueMatt/2018-08-doc-usability-fixes

Simple log usability fix, add some missing docs

6 years agoRemove implicit Record import requirement in logging macros 2018-08-doc-usability-fixes
Matt Corallo [Mon, 20 Aug 2018 16:56:17 +0000 (12:56 -0400)]
Remove implicit Record import requirement in logging macros

6 years agoAdd APIError docs
Matt Corallo [Fri, 17 Aug 2018 18:29:16 +0000 (14:29 -0400)]
Add APIError docs

6 years agoMerge pull request #118 from TheBlueMatt/2018-08-103-rebased
Matt Corallo [Fri, 17 Aug 2018 18:00:50 +0000 (14:00 -0400)]
Merge pull request #118 from TheBlueMatt/2018-08-103-rebased

Rebase of #103

6 years agoMerge pull request #117 from TheBlueMatt/2018-08-no-claim-fuzz-bug
Matt Corallo [Fri, 17 Aug 2018 17:25:57 +0000 (13:25 -0400)]
Merge pull request #117 from TheBlueMatt/2018-08-no-claim-fuzz-bug

Don't HTLC claim with no-possible-preimage in full_stack_target

6 years agoIgnore unknown channel flags as required in BOLT 2 2018-08-103-rebased
Matt Corallo [Fri, 17 Aug 2018 17:22:44 +0000 (13:22 -0400)]
Ignore unknown channel flags as required in BOLT 2

6 years agoadd 1% chnnel reserve while keeping min value
Yuntai Kyong [Fri, 17 Aug 2018 17:12:58 +0000 (13:12 -0400)]
add 1% chnnel reserve while keeping min value

if 1000 is always used it will almost always fail test reserve < dust_limit check

6 years agoAdd checking locally derived reserve and dust limit
Yuntai Kyong [Fri, 17 Aug 2018 03:57:51 +0000 (12:57 +0900)]
Add checking locally derived reserve and dust limit

6 years agodocument optional channel constraints per spec
Yuntai Kyong [Tue, 14 Aug 2018 16:18:10 +0000 (01:18 +0900)]
document optional channel constraints per spec

6 years agoAdd various checking when handling open and accept
Yuntai Kyong [Tue, 14 Aug 2018 16:12:40 +0000 (01:12 +0900)]
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`

6 years agoAdd push_msat to new outbound API
Yuntai Kyong [Tue, 14 Aug 2018 15:59:42 +0000 (00:59 +0900)]
Add push_msat to new outbound API

Also add APIMisuseError to be thrown to the API client

6 years agoAdd APIError enum
Yuntai Kyong [Fri, 17 Aug 2018 03:46:17 +0000 (12:46 +0900)]
Add APIError enum

`APIMisuse` when paramters passed from the client is invalid
`FeeRateTooHigh` when a channel cannot be opened due to high feerate

6 years agoDon't HTLC claim with no-possible-preimage in full_stack_target 2018-08-no-claim-fuzz-bug
Matt Corallo [Fri, 17 Aug 2018 15:53:47 +0000 (11:53 -0400)]
Don't HTLC claim with no-possible-preimage in full_stack_target

6 years agoMerge pull request #116 from TheBlueMatt/2018-08-peer_handler-trace
Matt Corallo [Fri, 17 Aug 2018 03:35:09 +0000 (23:35 -0400)]
Merge pull request #116 from TheBlueMatt/2018-08-peer_handler-trace

Add some trace logging in peer_handler

6 years agoAdd some trace logging in peer_handler 2018-08-peer_handler-trace
Matt Corallo [Fri, 17 Aug 2018 02:38:49 +0000 (22:38 -0400)]
Add some trace logging in peer_handler

6 years agoDefault test logger to Trace to make error debugging easier
Matt Corallo [Fri, 17 Aug 2018 02:30:18 +0000 (22:30 -0400)]
Default test logger to Trace to make error debugging easier

6 years agoAdd some useful delayed-formatting formatters to macro_logger
Matt Corallo [Fri, 17 Aug 2018 02:30:03 +0000 (22:30 -0400)]
Add some useful delayed-formatting formatters to macro_logger

6 years agoRemove some dead Logger code
Matt Corallo [Fri, 17 Aug 2018 01:25:56 +0000 (21:25 -0400)]
Remove some dead Logger code

6 years agoMerge pull request #115 from TheBlueMatt/2018-08-channel-fuzz-fixes
Matt Corallo [Fri, 17 Aug 2018 03:04:12 +0000 (23:04 -0400)]
Merge pull request #115 from TheBlueMatt/2018-08-channel-fuzz-fixes

Fixes from channelmanager fuzzing work

6 years agoFix PaymentReceived/sha256 handling in full_stack_target 2018-08-channel-fuzz-fixes
Matt Corallo [Thu, 16 Aug 2018 14:31:10 +0000 (10:31 -0400)]
Fix PaymentReceived/sha256 handling in full_stack_target

Sha256 in fuzztarget was updated some time ago to use XOR instead
of the first byte of a real SHA256 run and somehow received and
sent payments got crossed in full_stack_target.

6 years agoHandle duplicate funding transaction gracefully.
Matt Corallo [Wed, 15 Aug 2018 19:43:29 +0000 (15:43 -0400)]
Handle duplicate funding transaction gracefully.

This can otherwise cause strange behavior, including a panic on
force_close_all_channels found by full_stack_target fuzzing.

6 years agoFix handle_funding_created bug/TODO
Matt Corallo [Thu, 16 Aug 2018 15:27:16 +0000 (11:27 -0400)]
Fix handle_funding_created bug/TODO

The fuzzer was able to tickle this

6 years agoFix bug in early-HTLC-fulfill handling
Matt Corallo [Tue, 14 Aug 2018 20:29:00 +0000 (16:29 -0400)]
Fix bug in early-HTLC-fulfill handling

Caught by fuzzer. See new comments for more

6 years agoMerge pull request #110 from TheBlueMatt/2018-08-router-crashes-2
Matt Corallo [Fri, 17 Aug 2018 02:07:47 +0000 (22:07 -0400)]
Merge pull request #110 from TheBlueMatt/2018-08-router-crashes-2

Fix several fuzzer-found bugs

6 years ago[Router] Remove channels from nodes when the channel is failed 2018-08-router-crashes-2
Matt Corallo [Thu, 16 Aug 2018 14:17:33 +0000 (10:17 -0400)]
[Router] Remove channels from nodes when the channel is failed

Found by fuzzer

6 years agoHandle only-path-overflows-fee in get_route and avoid PubKey::new()
Matt Corallo [Wed, 15 Aug 2018 21:13:34 +0000 (17:13 -0400)]
Handle only-path-overflows-fee in get_route and avoid PubKey::new()

Found by fuzzer

6 years agoFix fee_base_msat overflowing entire fee range in RouteHint
Matt Corallo [Wed, 15 Aug 2018 19:50:14 +0000 (15:50 -0400)]
Fix fee_base_msat overflowing entire fee range in RouteHint

6 years agoErr from get_route if the requested value is more than 21m BTC
Matt Corallo [Tue, 14 Aug 2018 20:40:40 +0000 (16:40 -0400)]
Err from get_route if the requested value is more than 21m BTC

This fixes a potential overflow panic.

6 years agoCorrect lowest_inbound_proportional_fee deduction in route finding
Matt Corallo [Tue, 14 Aug 2018 19:56:58 +0000 (15:56 -0400)]
Correct lowest_inbound_proportional_fee deduction in route finding

Found cause fuzzer was able to crash us if we don't

6 years agoFix multiply-with-overflow panic in router
Matt Corallo [Tue, 14 Aug 2018 14:34:20 +0000 (10:34 -0400)]
Fix multiply-with-overflow panic in router

Found by fuzzer

6 years agoMerge pull request #91 from ariard/logging_interface
Matt Corallo [Fri, 17 Aug 2018 00:24:49 +0000 (20:24 -0400)]
Merge pull request #91 from ariard/logging_interface

Logging interface

6 years agoLogging interface
Antoine Riard [Wed, 25 Jul 2018 02:34:51 +0000 (02:34 +0000)]
Logging interface

Implement error, warn, info, debug and trace macros, internally calling
an instance of Logger, and passing it to every main structures
Build-time or client-side filtering.
Issue #54

6 years agoMerge pull request #107 from ariard/event_handle_error
Matt Corallo [Thu, 16 Aug 2018 20:26:00 +0000 (16:26 -0400)]
Merge pull request #107 from ariard/event_handle_error

Implement HandleError event with ErrorAction field

6 years agoImplement HandleError event with ErrorAction field
Antoine Riard [Wed, 1 Aug 2018 16:34:03 +0000 (16:34 +0000)]
Implement HandleError event with ErrorAction field

6 years agoMerge pull request #108 from TheBlueMatt/2018-08-fuzz-fixes
Matt Corallo [Mon, 6 Aug 2018 03:04:18 +0000 (23:04 -0400)]
Merge pull request #108 from TheBlueMatt/2018-08-fuzz-fixes

Asorted Fixes from full_stack_target work

6 years agoFix UpdateAddHTLC serialize vec capacity default 2018-08-fuzz-fixes
Matt Corallo [Fri, 3 Aug 2018 02:21:06 +0000 (22:21 -0400)]
Fix UpdateAddHTLC serialize vec capacity default

6 years agoStub out ChaCha20 non-HMAC encryption/decryption in fuzztarget
Matt Corallo [Fri, 3 Aug 2018 00:05:14 +0000 (20:05 -0400)]
Stub out ChaCha20 non-HMAC encryption/decryption in fuzztarget

6 years agoFix fuzztarget insert_combine hash-collision panic
Matt Corallo [Thu, 2 Aug 2018 10:32:11 +0000 (06:32 -0400)]
Fix fuzztarget insert_combine hash-collision panic

6 years agoFix panic on reorg through the funding_locked-generating block
Matt Corallo [Thu, 2 Aug 2018 10:23:53 +0000 (06:23 -0400)]
Fix panic on reorg through the funding_locked-generating block

We had a TODO to handle "lost confirmation" in block_connected,
which we recently did in block_disconnected (calling force_shutdown
in case we get too many blocks disconnected) but didn't handle the
case where we had a simple reorg through the block that resulted in
us generating a funding_locked.

6 years agoFix fuzztarget ChannelKeys generation
Matt Corallo [Wed, 1 Aug 2018 20:37:58 +0000 (16:37 -0400)]
Fix fuzztarget ChannelKeys generation

6 years agoFix types in Channel::funding_tx_confirmed_in
Matt Corallo [Wed, 1 Aug 2018 20:13:04 +0000 (16:13 -0400)]
Fix types in Channel::funding_tx_confirmed_in

This should have no effect in a real system but was causing the
full_stack_target fuzz test to fail due to a block with a null hash
being disconnected.

6 years agoFix panic!() in block_connected on unfunded channels (fixes #42)
Matt Corallo [Wed, 1 Aug 2018 03:48:54 +0000 (23:48 -0400)]
Fix panic!() in block_connected on unfunded channels (fixes #42)

The new full_stack_target fuzzing stuff was able to find this bug,
which gives me a bit of hope for full_stack_target's utility.

6 years agoMerge pull request #100 from TheBlueMatt/2018-07-htlc-balance-calc
Matt Corallo [Tue, 31 Jul 2018 04:59:31 +0000 (00:59 -0400)]
Merge pull request #100 from TheBlueMatt/2018-07-htlc-balance-calc

Fix non-HTLC-inclusion balance calculation (mark II)

6 years agoMerge pull request #102 from savil/hex-version
Matt Corallo [Tue, 31 Jul 2018 01:50:19 +0000 (21:50 -0400)]
Merge pull request #102 from savil/hex-version

change hex version to 0.3, and leave out the minor bumps

6 years agochange hex version to 0.3, and leave out the minor bumps
Savil Srivastava [Tue, 31 Jul 2018 00:01:57 +0000 (17:01 -0700)]
change hex version to 0.3, and leave out the minor bumps

6 years agoFix non-HTLC-inclusion balance calculation (mark II) 2018-07-htlc-balance-calc
Matt Corallo [Mon, 30 Jul 2018 22:05:50 +0000 (18:05 -0400)]
Fix non-HTLC-inclusion balance calculation (mark II)

6 years agoMerge pull request #98 from TheBlueMatt/2018-07-invalid-funding
Matt Corallo [Sun, 29 Jul 2018 18:25:18 +0000 (14:25 -0400)]
Merge pull request #98 from TheBlueMatt/2018-07-invalid-funding

Handle invalid funding tx in channelmanager

6 years agoMerge pull request #97 from TheBlueMatt/2018-07-no-useless-preimages
Matt Corallo [Sun, 29 Jul 2018 18:01:14 +0000 (14:01 -0400)]
Merge pull request #97 from TheBlueMatt/2018-07-no-useless-preimages

Stop adding remote's payment_preimages to our channel monitor

6 years agoMerge pull request #96 from TheBlueMatt/2018-07-force-close-handling
Matt Corallo [Sun, 29 Jul 2018 17:39:17 +0000 (13:39 -0400)]
Merge pull request #96 from TheBlueMatt/2018-07-force-close-handling

Add pending-HTLC-failure to and unify force_shutdown() handling

6 years agoHandle invalid funding tx in channelmanager 2018-07-invalid-funding
Matt Corallo [Sun, 29 Jul 2018 05:59:42 +0000 (01:59 -0400)]
Handle invalid funding tx in channelmanager

6 years agoStop adding remote's payment_preimages to our channel monitor 2018-07-no-useless-preimages
Matt Corallo [Sat, 28 Jul 2018 22:32:58 +0000 (18:32 -0400)]
Stop adding remote's payment_preimages to our channel monitor

6 years agoSome match -> if let replacement
Matt Corallo [Sat, 28 Jul 2018 21:39:33 +0000 (17:39 -0400)]
Some match -> if let replacement

6 years agoAssert usize is 32 or 64 bits, as required in a TODO
Matt Corallo [Sat, 28 Jul 2018 21:39:10 +0000 (17:39 -0400)]
Assert usize is 32 or 64 bits, as required in a TODO

6 years agoRemove some excess mut's 1.22 complains about
Matt Corallo [Sun, 29 Jul 2018 17:29:36 +0000 (13:29 -0400)]
Remove some excess mut's 1.22 complains about

6 years agoAdd pending-HTLC-failure to and unify force_shutdown() handling 2018-07-force-close-handling
Matt Corallo [Sat, 28 Jul 2018 23:15:45 +0000 (19:15 -0400)]
Add pending-HTLC-failure to and unify force_shutdown() handling

This patch got a bit bigger than I'd intended, but primarily this
unifies force_shutdown() handling so all the callsites at least
look similar. It also fails backwards any HTLCs which were
completely pending (ie hadn't been committed to) and ensures we
broadcast our local commitment transaction. It also adds a
force_close_channel method to ChannelManager to expose
force-closure.

6 years agoRemove some useless Vecs
Matt Corallo [Sat, 28 Jul 2018 23:15:20 +0000 (19:15 -0400)]
Remove some useless Vecs

6 years agoClean up forward_/claimable_htlcs handling and document consistency
Matt Corallo [Sat, 28 Jul 2018 22:32:43 +0000 (18:32 -0400)]
Clean up forward_/claimable_htlcs handling and document consistency

6 years agoFix force_shutdown() bug where we lose knowledge of a preimage
Matt Corallo [Thu, 26 Jul 2018 21:53:10 +0000 (17:53 -0400)]
Fix force_shutdown() bug where we lose knowledge of a preimage

In case we are in AwaitingRemoteRevoke and we go to claim an HTLC
(at which point we've already given up the money to the next hop in
the payment) we just write it to holding_cell_htlc_updates.
However, we should be ensuring we *also* write it to our
channel_monitor as we need to make sure we can still claim it after
a force_shutdown() or otherwise after hitting the chain.

6 years agoMerge pull request #95 from savil/rm-bitcoin-util-hexbytes
Matt Corallo [Sat, 28 Jul 2018 20:19:33 +0000 (16:19 -0400)]
Merge pull request #95 from savil/rm-bitcoin-util-hexbytes

replace use of bitcoin::utils::misc::hex_bytes with hex::decode

6 years agouse hex::decode instead of extend_vec_from_hex
Savil Srivastava [Sat, 28 Jul 2018 16:44:15 +0000 (09:44 -0700)]
use hex::decode instead of extend_vec_from_hex

6 years agoreplace use of bitcoin::utils::misc::hex_bytes with hex::decode
Savil Srivastava [Sat, 28 Jul 2018 00:06:14 +0000 (17:06 -0700)]
replace use of bitcoin::utils::misc::hex_bytes with hex::decode

as requested in #84 discussion
https://github.com/rust-bitcoin/rust-lightning/pull/84#discussion_r205508845

6 years agoMerge pull request #94 from TheBlueMatt/2018-07-duplicate_hash
Matt Corallo [Fri, 27 Jul 2018 16:24:14 +0000 (12:24 -0400)]
Merge pull request #94 from TheBlueMatt/2018-07-duplicate_hash

Handle duplicate payment_hash send_payment()s