]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
5 years agoMerge tracking of HTLCs-in-commitment with outbound-HTLCs 2019-01-merge-htlc-tracking
Matt Corallo [Fri, 4 Jan 2019 19:37:48 +0000 (14:37 -0500)]
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.

5 years agoMake HTLCOutputInCommitment::transaction_output_index an Option
Matt Corallo [Thu, 3 Jan 2019 00:15:10 +0000 (19:15 -0500)]
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.

5 years agoFix stale comment in functional_tests after failing back async 2018-12-no-to-remote-revoked-htlcs
Matt Corallo [Sat, 5 Jan 2019 21:18:09 +0000 (16:18 -0500)]
Fix stale comment in functional_tests after failing back async

5 years agoMacro-DRY HTLC back-fails for revoked remote transaction broadcast
Matt Corallo [Thu, 27 Dec 2018 19:12:11 +0000 (14:12 -0500)]
Macro-DRY HTLC back-fails for revoked remote transaction broadcast

5 years agoAdd test_commitment_revoked_fail_backward_exhaustive no_to_remote
Matt Corallo [Thu, 27 Dec 2018 18:55:40 +0000 (13:55 -0500)]
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.

5 years agoAdd dust mode to test_commitment_revoked_fail_backward_exhaustive
Matt Corallo [Thu, 27 Dec 2018 18:53:58 +0000 (13:53 -0500)]
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.

5 years agoMove fail-backwards up for no to-remote output claims
Matt Corallo [Fri, 21 Dec 2018 19:32:44 +0000 (14:32 -0500)]
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.

5 years agoMerge pull request #278 from TheBlueMatt/2018-12-fail-on-unrevoked-remote
Matt Corallo [Tue, 1 Jan 2019 01:25:44 +0000 (20:25 -0500)]
Merge pull request #278 from TheBlueMatt/2018-12-fail-on-unrevoked-remote

Fail HTLC backwards on unrevoked remote commitment tx broadcast

5 years agoMore comments/hardening test_fail_backwards_unrevoked_remote_announce 2018-12-fail-on-unrevoked-remote
Antoine Riard [Sun, 30 Dec 2018 19:10:01 +0000 (14:10 -0500)]
More comments/hardening test_fail_backwards_unrevoked_remote_announce

5 years agoFail HTLC backwards on unrevoked remote commitment tx broadcast
Matt Corallo [Fri, 21 Dec 2018 20:16:46 +0000 (15:16 -0500)]
Fail HTLC backwards on unrevoked remote commitment tx broadcast

5 years agoMacro-out BroadcastChannelUpdate-on-channel-close in func tests
Matt Corallo [Fri, 21 Dec 2018 20:15:56 +0000 (15:15 -0500)]
Macro-out BroadcastChannelUpdate-on-channel-close in func tests

5 years agoLog errors forwarding/failing HTLCs
Matt Corallo [Fri, 21 Dec 2018 18:40:51 +0000 (13:40 -0500)]
Log errors forwarding/failing HTLCs

5 years agoRemove long-stale TODO
Matt Corallo [Fri, 21 Dec 2018 03:51:06 +0000 (22:51 -0500)]
Remove long-stale TODO

5 years agoMerge pull request #276 from TheBlueMatt/2018-12-async-fail
Matt Corallo [Sat, 22 Dec 2018 12:02:41 +0000 (07:02 -0500)]
Merge pull request #276 from TheBlueMatt/2018-12-async-fail

 Fail HTLCs backwards asynchronously

5 years agoFail HTLCs backwards asynchronously 2018-12-async-fail
Matt Corallo [Fri, 21 Dec 2018 03:50:25 +0000 (22:50 -0500)]
Fail HTLCs backwards asynchronously

5 years agoAdd an enum option to pending forwards to fail backwards
Matt Corallo [Thu, 20 Dec 2018 21:15:07 +0000 (16:15 -0500)]
Add an enum option to pending forwards to fail backwards

5 years agoRefactor HTLCForwardInfo into an enum in prep for delayed-fail
Matt Corallo [Thu, 20 Dec 2018 20:36:02 +0000 (15:36 -0500)]
Refactor HTLCForwardInfo into an enum in prep for delayed-fail

5 years agomacro-out a bunch of PendingHTLCsForwardable+forward calls
Matt Corallo [Thu, 20 Dec 2018 19:21:18 +0000 (14:21 -0500)]
macro-out a bunch of PendingHTLCsForwardable+forward calls

5 years agoMove process_onion_failure into onion_utils
Matt Corallo [Thu, 20 Dec 2018 19:51:18 +0000 (14:51 -0500)]
Move process_onion_failure into onion_utils

5 years agoMerge pull request #275 from TheBlueMatt/2018-12-manager-split
Matt Corallo [Thu, 20 Dec 2018 19:59:22 +0000 (14:59 -0500)]
Merge pull request #275 from TheBlueMatt/2018-12-manager-split

Split up ChannelManager

5 years agoDrop needless mut found by rustc 1.22 2018-12-manager-split
Matt Corallo [Wed, 19 Dec 2018 22:28:09 +0000 (17:28 -0500)]
Drop needless mut found by rustc 1.22

5 years agoMove ChannelManager network tests into their own module
Matt Corallo [Wed, 19 Dec 2018 22:14:15 +0000 (17:14 -0500)]
Move ChannelManager network tests into their own module

5 years agoMove onion encryption/decryption/etc into an onion_utils module
Matt Corallo [Wed, 19 Dec 2018 22:02:27 +0000 (17:02 -0500)]
Move onion encryption/decryption/etc into an onion_utils module

5 years agoDrop channel_held_info which was only for the channel fuzz target
Matt Corallo [Wed, 19 Dec 2018 21:36:26 +0000 (16:36 -0500)]
Drop channel_held_info which was only for the channel fuzz target

5 years agoMerge pull request #270 from TheBlueMatt/2018-12-drop-rust-crypto
Matt Corallo [Thu, 20 Dec 2018 01:35:46 +0000 (20:35 -0500)]
Merge pull request #270 from TheBlueMatt/2018-12-drop-rust-crypto

Drop rust-crypto for bitcoin_hashes

5 years agotrace_log more in channelmonitor 2018-12-drop-rust-crypto
Matt Corallo [Thu, 20 Dec 2018 00:36:27 +0000 (19:36 -0500)]
trace_log more in channelmonitor

5 years agoUse bitcoin_hashes' fixed_time_eq, removing the rust-crypto dep
Matt Corallo [Tue, 18 Dec 2018 05:01:31 +0000 (00:01 -0500)]
Use bitcoin_hashes' fixed_time_eq, removing the rust-crypto dep

5 years agoDrop rust-crypto trait usage
Matt Corallo [Fri, 14 Dec 2018 20:48:05 +0000 (15:48 -0500)]
Drop rust-crypto trait usage

5 years agoSteal rust-crypto's Poly1305 implementation wholesale
Matt Corallo [Fri, 14 Dec 2018 18:29:55 +0000 (13:29 -0500)]
Steal rust-crypto's Poly1305 implementation wholesale

5 years agoSteal rust-crypto's ChaCha20 implementation wholesale
Matt Corallo [Thu, 13 Dec 2018 22:18:31 +0000 (17:18 -0500)]
Steal rust-crypto's ChaCha20 implementation wholesale

5 years agoUse bitcoin_hashes' Ripemd160/Hash160 from rust-crypto+rust-bitcoin
Matt Corallo [Thu, 13 Dec 2018 21:23:22 +0000 (16:23 -0500)]
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.

5 years agoSwitch Sha256 to using bitcoin_hashes and our own HKDF
Matt Corallo [Tue, 18 Dec 2018 04:58:02 +0000 (23:58 -0500)]
Switch Sha256 to using bitcoin_hashes and our own HKDF

5 years agoChange the way channel keys are generated
Matt Corallo [Fri, 14 Dec 2018 20:55:46 +0000 (15:55 -0500)]
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

5 years agoMerge pull request #274 from TheBlueMatt/2018-12-243-review
Matt Corallo [Tue, 18 Dec 2018 04:33:22 +0000 (23:33 -0500)]
Merge pull request #274 from TheBlueMatt/2018-12-243-review

Onion Error Handling

5 years agoUpdate incorrect_payment_amount generation/handling for BOLT uptd 2018-12-243-review
Matt Corallo [Tue, 18 Dec 2018 03:43:05 +0000 (22:43 -0500)]
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.

5 years agoAdd tests for process_onion_failure return value sanity
Yuntai Kyong [Mon, 17 Dec 2018 23:55:48 +0000 (18:55 -0500)]
Add tests for process_onion_failure return value sanity

5 years agoAdd test_util for overriding session privs for onion crypt
Matt Corallo [Mon, 17 Dec 2018 19:20:27 +0000 (14:20 -0500)]
Add test_util for overriding session privs for onion crypt

5 years agoAdd some additional channel-creation-broadcast-msg sanity checks
Matt Corallo [Mon, 17 Dec 2018 23:55:22 +0000 (18:55 -0500)]
Add some additional channel-creation-broadcast-msg sanity checks

5 years agoAlways return malformed for BADONION errors
Matt Corallo [Mon, 17 Dec 2018 20:25:32 +0000 (15:25 -0500)]
Always return malformed for BADONION errors

Also be willing to forward something with a pubkey that we know is
complete garbage, but upstream will just fail that with BADONION
when they get it.

I think this is kinda intended by the spec, but it definitely needs
to be clarified.

5 years agoAdd TODO noting confusion over |20 (channel_disabled) definition
Matt Corallo [Mon, 17 Dec 2018 19:46:17 +0000 (14:46 -0500)]
Add TODO noting confusion over |20 (channel_disabled) definition

5 years agoInclude flags when sending channel_disabled onion errors
Yuntai Kyong [Mon, 17 Dec 2018 19:25:38 +0000 (14:25 -0500)]
Include flags when sending channel_disabled onion errors

5 years agoRewrite most of process_onion_failure
Yuntai Kyong [Mon, 17 Dec 2018 23:54:48 +0000 (18:54 -0500)]
Rewrite most of process_onion_failure

5 years agoSwap an if let for a match and add some TODO
Yuntai Kyong [Mon, 17 Dec 2018 18:49:12 +0000 (13:49 -0500)]
Swap an if let for a match and add some TODO

5 years agoMerge pull request #273 from ariard/2018-12-17-replace-by-permanent-channel-failure
Matt Corallo [Tue, 18 Dec 2018 03:55:22 +0000 (22:55 -0500)]
Merge pull request #273 from ariard/2018-12-17-replace-by-permanent-channel-failure

Replace some unknown_next_peer by permanent_channel_failure

5 years agoReplace some unknown_next_peer by permanent_channel_failure
Antoine Riard [Tue, 18 Dec 2018 01:47:19 +0000 (20:47 -0500)]
Replace some unknown_next_peer by permanent_channel_failure

5 years agoMerge pull request #269 from TheBlueMatt/2018-12-198-review
Matt Corallo [Mon, 17 Dec 2018 17:11:36 +0000 (12:11 -0500)]
Merge pull request #269 from TheBlueMatt/2018-12-198-review

Detect HTLC-resolving on-chain actions and pass them to ChannelManager

5 years agoAdd some TODOs for correctness in ChannelMonitor 2018-12-198-review
Matt Corallo [Wed, 12 Dec 2018 19:42:09 +0000 (14:42 -0500)]
Add some TODOs for correctness in ChannelMonitor

5 years agoAdd constant for HTLC failure anti-reorg delay
Matt Corallo [Wed, 12 Dec 2018 20:25:57 +0000 (15:25 -0500)]
Add constant for HTLC failure anti-reorg delay

5 years agoInclude the node id in ChannelManager test logs
Matt Corallo [Tue, 11 Dec 2018 02:30:55 +0000 (21:30 -0500)]
Include the node id in ChannelManager test logs

5 years agoAdd additional log traces in channelmonitor/manager
Matt Corallo [Sun, 9 Dec 2018 17:17:27 +0000 (12:17 -0500)]
Add additional log traces in channelmonitor/manager

5 years agoAdd logging of HTLC outputs resolved by remote peer justice tx
Antoine Riard [Mon, 3 Dec 2018 02:27:26 +0000 (21:27 -0500)]
Add logging of HTLC outputs resolved by remote peer justice tx

In case of broadcast of revoked local commitment tx, we may be
interested that we've screwed up

5 years agoTypify payment_hash and payment_preimage
Antoine Riard [Fri, 23 Nov 2018 02:18:16 +0000 (21:18 -0500)]
Typify payment_hash and payment_preimage

Fix variable name as payment_hash instead of txid for index
of remote_hash_commitment_number in ChannelMonitor reader

5 years agoAdd bigger test for failing HTLCs claimed through revocation
Matt Corallo [Tue, 11 Dec 2018 03:53:54 +0000 (22:53 -0500)]
Add bigger test for failing HTLCs claimed through revocation

5 years agoAdd test for failing/fulfilling HTLCs from on-chain actions
Antoine Riard [Mon, 10 Dec 2018 19:25:31 +0000 (14:25 -0500)]
Add test for failing/fulfilling HTLCs from on-chain actions

Including detection of timeout claims, fulfill claims, and
failing all current HTLCs in case of revoked-commitment broadcast.

5 years agoAdd const ACCEPTED_HTLC_SCRIPT_WEIGHT and OFFERED_HTLC_SCRIPT_WEIGHT to
Antoine Riard [Wed, 10 Oct 2018 01:30:03 +0000 (01:30 +0000)]
Add const ACCEPTED_HTLC_SCRIPT_WEIGHT and OFFERED_HTLC_SCRIPT_WEIGHT to
ease readability

Conditionnal compilation for weight of second one to handle test special
cltv values

5 years agoGenerate PaymentFailed events for outbound payments we fail
Matt Corallo [Tue, 11 Dec 2018 04:27:47 +0000 (23:27 -0500)]
Generate PaymentFailed events for outbound payments we fail

5 years agoMove monitor-generated HTLC event handling to manager event-getters
Matt Corallo [Tue, 11 Dec 2018 03:47:21 +0000 (22:47 -0500)]
Move monitor-generated HTLC event handling to manager event-getters

This is somewhat awkward, but prevents a slew of duplicate events.
Really this should probably be more explicit, but would be easy to
move that along with a slew of block_connected-event-processing
refactors, see-also GH #80.

This affects full_stack_target only on accident cause the demo test
didn't continue onwards with another block connection.

5 years agoFail all pending HTLCs if the remote broadcasts a revoked tx
Matt Corallo [Tue, 11 Dec 2018 04:56:34 +0000 (23:56 -0500)]
Fail all pending HTLCs if the remote broadcasts a revoked tx

5 years agoDetect onchain timeout of a HTLC in ChannelManager block_connected
Antoine Riard [Mon, 10 Dec 2018 19:28:24 +0000 (14:28 -0500)]
Detect onchain timeout of a HTLC in ChannelManager block_connected

Pass failure backward

5 years agoAdd is_resolving_output in ChannelMonitor
Antoine Riard [Tue, 11 Dec 2018 04:56:02 +0000 (23:56 -0500)]
Add is_resolving_output in ChannelMonitor

Called in ChannelMonitor block_connected, returning
HTLCUpdate upstream via ManyChannelMonitor to
link htlcs between monitors. Used by ChannelManager to
fulfill/fail htlcs backwards accordingly

If spurrious HTLCUpdate are generated due to block re-scan
and htlc are already LocalRemoved, discard them in
channel get_update_*_htlc

5 years agoReturn refs from build_commitment_transaction, removing clone()s
Matt Corallo [Fri, 30 Nov 2018 21:06:28 +0000 (16:06 -0500)]
Return refs from build_commitment_transaction, removing clone()s

5 years agoTrack HTLCSource in ChannelMonitor
Antoine Riard [Fri, 30 Nov 2018 15:58:44 +0000 (10:58 -0500)]
Track HTLCSource in ChannelMonitor

Insert it in current_local_signed_tx, prev_local_signed_tx,
remote_claimable_outpoints. For so get it provided by
Channel calls to provide_latest_{local,remote}_tx

5 years agoTrack outputs fron local commitment tx
Antoine Riard [Tue, 27 Nov 2018 00:54:00 +0000 (19:54 -0500)]
Track outputs fron local commitment tx

Aims to detect onchain resolution of channel

Modify in consequence test_txn_broadcast to still pass
channel_monitor_network_test

Modify some tests due to block re-scan caused by
detections extensions

5 years agoMerge pull request #266 from TheBlueMatt/2018-12-closing_signed-3-leg-commitment
Matt Corallo [Tue, 11 Dec 2018 21:40:22 +0000 (16:40 -0500)]
Merge pull request #266 from TheBlueMatt/2018-12-closing_signed-3-leg-commitment

Remove check which makes us sometimes never send closing_signed

5 years agoMerge pull request #263 from TheBlueMatt/2018-12-monitor-fail-2
Matt Corallo [Tue, 11 Dec 2018 19:55:16 +0000 (14:55 -0500)]
Merge pull request #263 from TheBlueMatt/2018-12-monitor-fail-2

Handle monitor update failures in msg-recv functions

5 years agoExpand comment on ChannelMonitorUpdateErr::PermanentFailure a bit 2018-12-monitor-fail-2
Matt Corallo [Tue, 11 Dec 2018 18:16:38 +0000 (13:16 -0500)]
Expand comment on ChannelMonitorUpdateErr::PermanentFailure a bit

5 years agoAdd test for monitor update failure on CS/RAA/CR handling
Matt Corallo [Thu, 29 Nov 2018 22:19:53 +0000 (17:19 -0500)]
Add test for monitor update failure on CS/RAA/CR handling

5 years agoHandle monitor update failures in msg-recv functions
Matt Corallo [Tue, 27 Nov 2018 02:54:14 +0000 (21:54 -0500)]
Handle monitor update failures in msg-recv functions

This adds a few TODOs around further message rebroadcasting which
needs to be implemented as well as some loss of tracking of HTLCs
on permanent channel failure which needs to get transferred over to
the appropriate in-memory ChannelMonitor.

5 years agoSwap handle_monitor_update_fail for a macro ala try_chan_entry
Matt Corallo [Mon, 26 Nov 2018 21:40:15 +0000 (16:40 -0500)]
Swap handle_monitor_update_fail for a macro ala try_chan_entry

This resolves an API bug where send_payment may return a
MonitorUpdateFailed Err both when the payment will not be sent and
when the HTLC will be retried automatically when monitor updating
is restored. This makes it impossible for a client to know when
they should retry a payment and when they should not.

5 years agoMerge pull request #268 from TheBlueMatt/2015-12-fuzz-fix-output-idx
Matt Corallo [Mon, 10 Dec 2018 20:39:37 +0000 (15:39 -0500)]
Merge pull request #268 from TheBlueMatt/2015-12-fuzz-fix-output-idx

Check tx output matches monitor output data (and is sufficient len)

5 years agoCheck tx output matches monitor output data (and is sufficient len) 2015-12-fuzz-fix-output-idx
Matt Corallo [Mon, 10 Dec 2018 20:02:50 +0000 (15:02 -0500)]
Check tx output matches monitor output data (and is sufficient len)

Fixes a panic found by fuzzer in case the monitor per-commitment
data is garbage. We had a similar check for revoked commitment tx
but didn't copy it down to non-revoked commitment tx, so do that
now.

5 years agoMerge pull request #264 from TheBlueMatt/2018-12-198-first-commit
Matt Corallo [Tue, 4 Dec 2018 19:01:22 +0000 (14:01 -0500)]
Merge pull request #264 from TheBlueMatt/2018-12-198-first-commit

Refactor KeyStorage as Storage

5 years agoUnify the update pattern in provide_latest_local_commitment_tx_info 2018-12-198-first-commit
Matt Corallo [Sun, 2 Dec 2018 19:26:07 +0000 (14:26 -0500)]
Unify the update pattern in provide_latest_local_commitment_tx_info

5 years agoSimplify ChannelMonitor Storage updates a bit
Matt Corallo [Sun, 2 Dec 2018 19:11:13 +0000 (14:11 -0500)]
Simplify ChannelMonitor Storage updates a bit

5 years agoSimplify insert_combine by unimplemented!()ing unimplemented things
Matt Corallo [Sun, 2 Dec 2018 19:04:50 +0000 (14:04 -0500)]
Simplify insert_combine by unimplemented!()ing unimplemented things

5 years agoRefactor KeyStorage as Storage
Antoine Riard [Tue, 27 Nov 2018 00:50:16 +0000 (19:50 -0500)]
Refactor KeyStorage as Storage

Move PrivMode as Local, SigsMode as Watchtower

Cut funnding_txo from ChannelMonitor, move it inside Local

Rename log_funding_option as log_funding_info

5 years agoRemove check which makes us sometimes never send closing_signed 2018-12-closing_signed-3-leg-commitment
Matt Corallo [Tue, 27 Nov 2018 03:21:28 +0000 (22:21 -0500)]
Remove check which makes us sometimes never send closing_signed

This is the case pointed out by nayuta-gondo at
https://github.com/lightningnetwork/lightning-rfc/issues/499#issuecomment-438623208
though this doesn't actually solve the issue of ensuring we have a
consistent fee view when we start shutdown processing. There isn't
a clear solution to that however without adding additional state
tracking in Channel.

This also removes an associated test that tests for the correct
behavior (but didn't consider the bug) as we no longer behave
correctly. This should be fine as we'll be removing all the
update_fee garbage with option_simplified_commitment anyway.

5 years agoMerge pull request #265 from TheBlueMatt/2018-12-fuzz-fix-no-witness
Matt Corallo [Mon, 3 Dec 2018 19:38:56 +0000 (14:38 -0500)]
Merge pull request #265 from TheBlueMatt/2018-12-fuzz-fix-no-witness

Fix crash on no-witness tx in ChannelMonitor found by fuzzer

5 years agoAvoid writing to stdout during fuzz tests 2018-12-fuzz-fix-no-witness
Matt Corallo [Mon, 3 Dec 2018 18:58:11 +0000 (13:58 -0500)]
Avoid writing to stdout during fuzz tests

5 years agoRemove unused import in full_stack_target
Matt Corallo [Mon, 3 Dec 2018 18:30:18 +0000 (13:30 -0500)]
Remove unused import in full_stack_target

5 years agoFix crash on no-witness tx in ChannelMonitor found by fuzzer
Matt Corallo [Sun, 2 Dec 2018 23:22:40 +0000 (18:22 -0500)]
Fix crash on no-witness tx in ChannelMonitor found by fuzzer

Tehnically we can't currently hit this, but a theoretical future
watchtower could, and full_stack_target crashes on it.

5 years agoMerge pull request #261 from TheBlueMatt/2018-11-reestablish-fix
Matt Corallo [Mon, 3 Dec 2018 18:17:54 +0000 (13:17 -0500)]
Merge pull request #261 from TheBlueMatt/2018-11-reestablish-fix

Fix channel_reestablish generation/handling around next_remote.

5 years agoFix channel_reestablish generation/handling around next_remote. 2018-11-reestablish-fix
Matt Corallo [Mon, 26 Nov 2018 23:31:51 +0000 (18:31 -0500)]
Fix channel_reestablish generation/handling around next_remote.

6 years agoMerge pull request #260 from yuntai/201811-sessionkey
Matt Corallo [Tue, 27 Nov 2018 03:09:42 +0000 (22:09 -0500)]
Merge pull request #260 from yuntai/201811-sessionkey

Add a method to get session secret for onion packet to KeysInterface

6 years agoAdd a method to get session secret for onion packet to KeysInterface
Yuntai Kyong [Mon, 26 Nov 2018 11:10:01 +0000 (20:10 +0900)]
Add a method to get session secret for onion packet to KeysInterface

6 years agoMerge pull request #258 from TheBlueMatt/2018-11-close-locked
Matt Corallo [Mon, 26 Nov 2018 15:56:18 +0000 (10:56 -0500)]
Merge pull request #258 from TheBlueMatt/2018-11-close-locked

Simplify + document the ChannelManager Err flow, fix close-outside-lock race, finish ChannelError conversion

6 years agoMerge pull request #259 from TheBlueMatt/2018-11-256-redux
Matt Corallo [Fri, 23 Nov 2018 20:21:35 +0000 (15:21 -0500)]
Merge pull request #259 from TheBlueMatt/2018-11-256-redux

Add test_claim_on_remote_revoked_sizeable_push_msat

6 years agoAdd test_claim_on_remote_revoked_sizeable_push_msat 2018-11-256-redux
Antoine Riard [Fri, 23 Nov 2018 00:45:11 +0000 (19:45 -0500)]
Add test_claim_on_remote_revoked_sizeable_push_msat

6 years agoRefactor check spendable outputs macros into one
Antoine Riard [Fri, 23 Nov 2018 00:42:02 +0000 (19:42 -0500)]
Refactor check spendable outputs macros into one

In consequence, harden spendable outputs tests

Fix vocabulary abuse

6 years agoSimplify + document the ChannelManager Err flow a bit 2018-11-close-locked
Matt Corallo [Fri, 23 Nov 2018 03:45:51 +0000 (22:45 -0500)]
Simplify + document the ChannelManager Err flow a bit

This removes all the channel-closure stuff from handle_error!() and
MsgHandleErrInternal, making all the Err handling consistent by
closing the channel before releasing the channel_state lock and
then calling handle_error!() outside of the lock.

6 years agoRemove MsgHandleErrInternal::from_chan_maybe_close as it's useless
Matt Corallo [Fri, 23 Nov 2018 00:38:28 +0000 (19:38 -0500)]
Remove MsgHandleErrInternal::from_chan_maybe_close as it's useless

Technically funding_transaction_generated was fine using it, but
calling force_shutdown on an empty Channel inside the channel_state
lock isn't a big deal and almost any other use of it would be
unsafe.

6 years agoProperly handle ChannelError::Close results in update_fee.
Matt Corallo [Thu, 22 Nov 2018 23:58:23 +0000 (18:58 -0500)]
Properly handle ChannelError::Close results in update_fee.

Best reviewed with -b

6 years agoProperly handle ChannelError::Close results in send_payment.
Matt Corallo [Thu, 22 Nov 2018 23:48:28 +0000 (18:48 -0500)]
Properly handle ChannelError::Close results in send_payment.

Best reviewed with -b

6 years agoClose channels on Err returns inside the same channel_state lock
Matt Corallo [Mon, 19 Nov 2018 03:01:32 +0000 (22:01 -0500)]
Close channels on Err returns inside the same channel_state lock

If we never accessed channels for a peer outside of a message
handler for that peer then this wouldn't be a problem since message
handlers are required to be serialized per-peer. However, that
isn't the world we live in - we may want to forward payments or we
may get a send_payment call.

6 years agoStop needlessly returning &HTLCSource out of Channel.
Matt Corallo [Thu, 22 Nov 2018 21:17:46 +0000 (16:17 -0500)]
Stop needlessly returning &HTLCSource out of Channel.

This moves a clone() inside Channel from ChannelManager making
references simpler for the coming refactors.

6 years agoRemove remaining uses of HandleError in Channel Err return values
Matt Corallo [Fri, 23 Nov 2018 01:50:13 +0000 (20:50 -0500)]
Remove remaining uses of HandleError in Channel Err return values

This converts block_connected failures to returning the
ErrorMessage that needs to be sent directly, since it always
results in channel closure and never results in needing to call
force_shutdown. It also converts update_add_htlc and closing_signed
handlers to ChannelError as the rest of the message handlers.

6 years agoSplit channel_reserve_test so we don't rely on unfilled Err actions
Matt Corallo [Fri, 23 Nov 2018 04:44:42 +0000 (23:44 -0500)]
Split channel_reserve_test so we don't rely on unfilled Err actions

Currently channel_reserve_test sends a garbage update_add_htlc
message and then relies on it being silently ignored to continue
using the channel. This shouldn't be the case, so take the easy
way out and split the test in two, at first not delivering the
bogus update_add_htlc and then delivering it, but not running the
rest of the test.

6 years agoMerge pull request #257 from TheBlueMatt/2018-11-007-bump
Matt Corallo [Wed, 21 Nov 2018 21:45:17 +0000 (16:45 -0500)]
Merge pull request #257 from TheBlueMatt/2018-11-007-bump

Bump to 0.0.7 for API rev

6 years agoBump to 0.0.7 for API rev 2018-11-007-bump
Matt Corallo [Wed, 21 Nov 2018 21:18:02 +0000 (16:18 -0500)]
Bump to 0.0.7 for API rev

6 years agoMerge pull request #246 from TheBlueMatt/2018-11-fuzz-crash-redux
Matt Corallo [Wed, 21 Nov 2018 21:17:01 +0000 (16:17 -0500)]
Merge pull request #246 from TheBlueMatt/2018-11-fuzz-crash-redux

Several fuzz-found bugfixes.