]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
5 years agoRemove useless test framework warnings
Antoine Riard [Sat, 26 Oct 2019 00:20:41 +0000 (20:20 -0400)]
Remove useless test framework warnings

5 years agoMerge pull request #377 from elichai/2019-08-update-deps
Matt Corallo [Sat, 24 Aug 2019 23:06:26 +0000 (23:06 +0000)]
Merge pull request #377 from elichai/2019-08-update-deps

Updating dependencies

5 years agoUpdate the fuzz and net-tokio crates
Elichai Turkel [Sat, 24 Aug 2019 00:12:12 +0000 (20:12 -0400)]
Update the fuzz and net-tokio crates

5 years agoCast weights to u64 to support the new rust-bitcoin api
Elichai Turkel [Fri, 23 Aug 2019 23:12:55 +0000 (19:12 -0400)]
Cast weights to u64 to support the new rust-bitcoin api

5 years agoUpdated bitcoin, bitcoin_hashes and secp256k1 dependencies
Elichai Turkel [Fri, 23 Aug 2019 23:06:30 +0000 (19:06 -0400)]
Updated bitcoin, bitcoin_hashes and secp256k1 dependencies

5 years agoMerge pull request #374 from dongcarl/2019-08-channel-open-sanity
Matt Corallo [Fri, 9 Aug 2019 16:53:33 +0000 (16:53 +0000)]
Merge pull request #374 from dongcarl/2019-08-channel-open-sanity

tests: Add sanity tests for ChannelOpens

5 years agotests: Add sanity tests for ChannelOpens
Carl Dong [Fri, 2 Aug 2019 20:49:30 +0000 (16:49 -0400)]
tests: Add sanity tests for ChannelOpens

5 years agoMerge pull request #349 from ariard/2019-07-data_loss
Matt Corallo [Tue, 6 Aug 2019 21:12:57 +0000 (21:12 +0000)]
Merge pull request #349 from ariard/2019-07-data_loss

Implement option_data_loss_protect on both sides

5 years agoAdd test_data_loss_protect
Antoine Riard [Tue, 23 Jul 2019 21:01:37 +0000 (17:01 -0400)]
Add test_data_loss_protect

5 years agoCache to_remote_script if we are fallen-behind
Antoine Riard [Fri, 2 Aug 2019 20:29:12 +0000 (16:29 -0400)]
Cache to_remote_script if we are fallen-behind

Also, restrict commitment transaction filters in ChannelMonitor::
block_connected

5 years agoMake get_latest_local_commitment_txn public
Antoine Riard [Thu, 1 Aug 2019 14:54:02 +0000 (10:54 -0400)]
Make get_latest_local_commitment_txn public

You may use it to get a broadcastable local toxic tx in case of fallen-behind,
i.e when receiving a channel_reestablish with a proof that our remote side
knows a higher revocation secret than the local commitment number we are aware
of. Broadcasting these transactions are UNSAFE, as they allow remote side to punish
you. Nevertheless you may want to broadcast them if remote don't close channel with his
higher commitment transaction after a substantial amount of time (a month or even a year)
to get back funds. Best may be to contact out-of-band the other node operator to coordinate
with him if option is available to you. In any-case, choice is up to the user.

Also, log toxic commitment tx id in channel_reestablish sending back
ChannelError::CloseDelayBroadcast

5 years agoEnforce option_data_loss_protect user-side
Antoine Riard [Wed, 10 Jul 2019 20:39:10 +0000 (16:39 -0400)]
Enforce option_data_loss_protect user-side

If we remote peer provide us a revocation secret which doesn't
match with next_remote_revocation_number we close the channel
If we learn that we are fallen-behind, we send back a CloseDelayBroadcast
error, special take care will be take to log error and channel should
stale, i.e we expect our honest peer to unilateral close to claim
on it our balance

Add ChannelError::CloseDelayBroadcast to signal that you need to close
the channel but not to broadcast it while however update ChannelMonitor
with remote per_commitment_point thanks to our peer being a gentleman

5 years agoMerge pull request #310 from ariard/2019-02-clarify-send-htlc-policy
Matt Corallo [Fri, 2 Aug 2019 19:30:41 +0000 (19:30 +0000)]
Merge pull request #310 from ariard/2019-02-clarify-send-htlc-policy

Clarify policy applied in send htlc error msgs

5 years agoClarify policy applied in send htlc error msgs
Antoine Riard [Thu, 14 Feb 2019 01:44:14 +0000 (20:44 -0500)]
Clarify policy applied in send htlc error msgs

max_htlc_value_in_flight_msat is applied
per-direction

5 years agoMerge pull request #370 from TheBlueMatt/2019-07-369-fix-spaces
Matt Corallo [Wed, 31 Jul 2019 15:58:00 +0000 (15:58 +0000)]
Merge pull request #370 from TheBlueMatt/2019-07-369-fix-spaces

2019 07 369 fix spaces

5 years agoAdd net-tokio/target to gitignore 2019-07-369-fix-spaces
RJ Rybarczyk [Wed, 31 Jul 2019 03:14:18 +0000 (03:14 +0000)]
Add net-tokio/target to gitignore

5 years agoMake SocketDescriptor::send_data take slice instead of vec and offset
RJ Rybarczyk [Wed, 31 Jul 2019 02:57:08 +0000 (02:57 +0000)]
Make SocketDescriptor::send_data take slice instead of vec and offset

5 years agoMerge pull request #367 from TheBlueMatt/2019-07-fst-unique-channels
Matt Corallo [Tue, 30 Jul 2019 18:26:57 +0000 (18:26 +0000)]
Merge pull request #367 from TheBlueMatt/2019-07-fst-unique-channels

Make temporary channel ids unique in full_stack_target

5 years agoMerge pull request #368 from TheBlueMatt/2019-07-travis-fix
Matt Corallo [Tue, 30 Jul 2019 18:26:11 +0000 (18:26 +0000)]
Merge pull request #368 from TheBlueMatt/2019-07-travis-fix

Fix travis failure if previous travis run on branch failed to build

5 years agoFix travis failure if previous travis run on branch failed to build 2019-07-travis-fix
Matt Corallo [Tue, 30 Jul 2019 17:40:45 +0000 (13:40 -0400)]
Fix travis failure if previous travis run on branch failed to build

5 years agoSupport option_data_loss_protect for remote peer
Antoine Riard [Wed, 10 Jul 2019 19:48:23 +0000 (15:48 -0400)]
Support option_data_loss_protect for remote peer

In case of sending channel_reestablish message, we join
our current per_commitment_point and their highest revocation
secret we know about

We set data_loss_protect by default and adjust encoding_init
test in consequence

5 years agoMerge pull request #364 from TheBlueMatt/2019-07-no-unimpl
Matt Corallo [Mon, 29 Jul 2019 19:20:35 +0000 (19:20 +0000)]
Merge pull request #364 from TheBlueMatt/2019-07-no-unimpl

Implement the last three (relevant) unimplemented()s in ChannelManager

5 years agoMerge pull request #366 from TheBlueMatt/2019-07-useless-todo-removal
Matt Corallo [Mon, 29 Jul 2019 17:48:42 +0000 (17:48 +0000)]
Merge pull request #366 from TheBlueMatt/2019-07-useless-todo-removal

Drop some useless TODO messages to clean things up pre-0.1

5 years agoHandle monitor update failure during funding on the fundee side 2019-07-no-unimpl
Matt Corallo [Mon, 29 Jul 2019 17:45:35 +0000 (13:45 -0400)]
Handle monitor update failure during funding on the fundee side

This carries a surprising amount of complexity despite only being
possible in the case where monitor updating failed during the
processing of funding_generated. Specifically, this requires
handling rebroadcasting funding_locked once we successfully persist
our monitor again.

As an alternative we could never send funding_signed when the
monitor failed to persist, but this approach avoids needless
delays during funding.

5 years agoAllow a counterparty to resend their funding_locked before ours
Matt Corallo [Mon, 29 Jul 2019 17:44:47 +0000 (13:44 -0400)]
Allow a counterparty to resend their funding_locked before ours

5 years agoHandle monitor update failures during funding on the funder side
Matt Corallo [Fri, 26 Jul 2019 22:05:05 +0000 (18:05 -0400)]
Handle monitor update failures during funding on the funder side

5 years agoMake temporary channel ids unique in full_stack_target 2019-07-fst-unique-channels
Matt Corallo [Mon, 29 Jul 2019 16:40:43 +0000 (12:40 -0400)]
Make temporary channel ids unique in full_stack_target

This avoids a crash where a channel with a duplicate id is created
immediately after another is closed, where the other still has a
pending funding generation event. Resulting in funding generation
being passed to the wrong channel (which isn't in an appropriate
state).

5 years agoDrop TODO suggesting we avoid a test-only function to get chan keys 2019-07-useless-todo-removal
Matt Corallo [Sun, 28 Jul 2019 00:49:44 +0000 (20:49 -0400)]
Drop TODO suggesting we avoid a test-only function to get chan keys

It suggested figuring something else out after #81, but the API we
settled on after #81 (which I think is just fine) doesn't allow for
anything cleaner, so this is fine as-is.

5 years agoDrop update_fee TODOs as we're gonna drop it before 0.1 anyway
Matt Corallo [Sun, 28 Jul 2019 00:46:17 +0000 (20:46 -0400)]
Drop update_fee TODOs as we're gonna drop it before 0.1 anyway

See #365 for more.

5 years agoMerge pull request #363 from TheBlueMatt/2019-07-codecov
Matt Corallo [Thu, 25 Jul 2019 21:34:16 +0000 (21:34 +0000)]
Merge pull request #363 from TheBlueMatt/2019-07-codecov

Generate codecov.io reports

5 years agoGenerate codecov.io reports 2019-07-codecov
Matt Corallo [Thu, 25 Jul 2019 20:26:30 +0000 (16:26 -0400)]
Generate codecov.io reports

5 years agoMerge pull request #361 from TheBlueMatt/2019-07-cmfc-crash
Matt Corallo [Thu, 25 Jul 2019 19:47:48 +0000 (19:47 +0000)]
Merge pull request #361 from TheBlueMatt/2019-07-cmfc-crash

Make chanmon_fail_consistency slightly less aggressive

5 years agoMerge pull request #362 from TheBlueMatt/2019-07-no-bogus-sec-required
Matt Corallo [Thu, 25 Jul 2019 19:46:58 +0000 (19:46 +0000)]
Merge pull request #362 from TheBlueMatt/2019-07-no-bogus-sec-required

Do not require upfront_shutdown as the security gain is marginal

5 years agoDo not require upfront_shutdown as the security gain is marginal 2019-07-no-bogus-sec-required
Matt Corallo [Thu, 25 Jul 2019 18:18:33 +0000 (14:18 -0400)]
Do not require upfront_shutdown as the security gain is marginal

There is really no reason to want to never open a channel just
because a counterparty doesn't support upfront_shutdown.

5 years agoMake chanmon_fail_consistency slightly less aggressive 2019-07-cmfc-crash
Matt Corallo [Thu, 25 Jul 2019 15:07:45 +0000 (11:07 -0400)]
Make chanmon_fail_consistency slightly less aggressive

This resolves some crashes that both afl and honggfuzz found.

5 years agoMerge pull request #360 from TheBlueMatt/2019-07-new-warnings
Matt Corallo [Wed, 24 Jul 2019 22:38:34 +0000 (22:38 +0000)]
Merge pull request #360 from TheBlueMatt/2019-07-new-warnings

Fix unused variable introduced in my changes in bdbf5666a9d693b9bf1

5 years agoMerge pull request #355 from ariard/2019-07-fix-csv-delay-check-remote-htlc
Matt Corallo [Wed, 24 Jul 2019 22:33:20 +0000 (22:33 +0000)]
Merge pull request #355 from ariard/2019-07-fix-csv-delay-check-remote-htlc

Fix bug in check_spend_remote_htlc and let csv delays being user configurable

5 years agoAdd test_user_configurable_csv_delay
Antoine Riard [Tue, 23 Jul 2019 17:34:07 +0000 (13:34 -0400)]
Add test_user_configurable_csv_delay

Extend test_justice_tx with user-set csv delay to test that
we are able to claim revokeable outputs with different csv delay
between both peers.

5 years agoAdd user configurable csv delay encumbering channel refund output,
Antoine Riard [Fri, 19 Jul 2019 23:23:10 +0000 (19:23 -0400)]
Add user configurable csv delay encumbering channel refund output,

within reasonable lower or upper bound

Add our_to_self_delay in Channel, to cache user config field at
channel construction.

5 years agoMove BREAKDOWN_TIMEOUT/MAX_LOCAL_BREAKDOWN_TIMEOUT in ChannelManager
Antoine Riard [Fri, 19 Jul 2019 23:36:23 +0000 (19:36 -0400)]
Move BREAKDOWN_TIMEOUT/MAX_LOCAL_BREAKDOWN_TIMEOUT in ChannelManager

Let these values being used as default ones in UserConfig.

Also, reduce them to something more reasonable, for BREAKDOWN_TIMEOUT
from 1 week to 1 day, for MAX_LOCAL_BREAKDOWN_TIMEOUT from 2 weeks
to 1.

5 years agoFix unused variable introduced in my changes in bdbf5666a9d693b9bf1 2019-07-new-warnings
Matt Corallo [Wed, 24 Jul 2019 21:21:10 +0000 (17:21 -0400)]
Fix unused variable introduced in my changes in bdbf5666a9d693b9bf1

The original was written by Tamas, but I made one small tweak and
broke the warning-free-ness of it.

5 years agoMerge pull request #359 from rust-bitcoin/2019-07-bump-percentage
Matt Corallo [Wed, 24 Jul 2019 21:19:48 +0000 (21:19 +0000)]
Merge pull request #359 from rust-bitcoin/2019-07-bump-percentage

Bump progress tracker

5 years agoMerge pull request #356 from TheBlueMatt/2019-07-more-chanmon-fuzz
Matt Corallo [Wed, 24 Jul 2019 21:19:39 +0000 (21:19 +0000)]
Merge pull request #356 from TheBlueMatt/2019-07-more-chanmon-fuzz

Add deserialize+load steps to chanmon_fail_consistency (fixes #327)

5 years agoBump progress tracker
Matt Corallo [Wed, 24 Jul 2019 20:03:48 +0000 (20:03 +0000)]
Bump progress tracker

Honestly mostly cause we have progress on simplified_commitment in Core, but also our punishment transaction generation stuff is really coming along nicely.

5 years agoMerge pull request #358 from TheBlueMatt/2019-07-no-unsafe
Matt Corallo [Wed, 24 Jul 2019 19:47:44 +0000 (19:47 +0000)]
Merge pull request #358 from TheBlueMatt/2019-07-no-unsafe

forbid unsafe

5 years agoAdd deserialize+load steps to chanmon_fail_consistency (fixes #327) 2019-07-more-chanmon-fuzz
Matt Corallo [Mon, 22 Jul 2019 21:28:49 +0000 (17:28 -0400)]
Add deserialize+load steps to chanmon_fail_consistency (fixes #327)

5 years agoforbid unsafe 2019-07-no-unsafe
Tamas Blummer [Wed, 24 Jul 2019 05:51:11 +0000 (07:51 +0200)]
forbid unsafe

5 years agoFix: use our_to_self_delay in check_spend_remote_htlc
Antoine Riard [Fri, 19 Jul 2019 21:57:17 +0000 (17:57 -0400)]
Fix: use our_to_self_delay in check_spend_remote_htlc

We were previously using their_to_self_delay to regenerate scripts for
spending remote revoked htlc transactions, and that's a bug.

Their_to_self_delay is delay enforced by peer upon outputs returning
funds back to us.

Our_to_self_delay is delay enforced by us upon outputs returning funds
back to peer.

5 years agoDrop msgs bound for a disconnecting peer at disconnect time
Matt Corallo [Tue, 23 Jul 2019 19:39:11 +0000 (15:39 -0400)]
Drop msgs bound for a disconnecting peer at disconnect time

This simplifies chanmon_fail_consistency greatly and makes it a
tiny bit more realistic. It also sets us up for more
disconnect-relatex events without the complexity blowing up.

5 years agoFix some newly-introduced unused-$THING warnings
Matt Corallo [Mon, 22 Jul 2019 21:46:17 +0000 (17:46 -0400)]
Fix some newly-introduced unused-$THING warnings

5 years agoMerge pull request #353 from TheBlueMatt/2019-07-no-rand
Matt Corallo [Tue, 23 Jul 2019 19:10:07 +0000 (19:10 +0000)]
Merge pull request #353 from TheBlueMatt/2019-07-no-rand

Make rand a dev-dependency

5 years agoMake rand a dev-dep by having the user randomize HTLC forward delay 2019-07-no-rand
Matt Corallo [Fri, 19 Jul 2019 02:21:00 +0000 (22:21 -0400)]
Make rand a dev-dep by having the user randomize HTLC forward delay

This removes the last calls to rand outside of test and moves the
dep to a dev-dependency, dropping our fuzz rng wrapper in the
process.

5 years agoStop using rng in peer_channel_encryptor to generate ephemeral keys
Matt Corallo [Fri, 19 Jul 2019 02:17:36 +0000 (22:17 -0400)]
Stop using rng in peer_channel_encryptor to generate ephemeral keys

This removes the bulk of our reliance on the rand crate in non-test
envs, paving a way towards a syscall-less rust-lightning and WASM.
Since this is a breaking change for full_stack_target (and several
fuzz targets), go ahead and make other changes to make things more
distinct.

5 years agoUpdate commitment tx to match actual tx (dunno when it broke)
Matt Corallo [Fri, 19 Jul 2019 22:24:41 +0000 (18:24 -0400)]
Update commitment tx to match actual tx (dunno when it broke)

5 years agoMove travis fuzzing to 1.34.2 to get integer atomics
Matt Corallo [Fri, 19 Jul 2019 21:58:08 +0000 (17:58 -0400)]
Move travis fuzzing to 1.34.2 to get integer atomics

5 years agoRemove dangling link in fuzz/
Matt Corallo [Fri, 19 Jul 2019 01:37:06 +0000 (21:37 -0400)]
Remove dangling link in fuzz/

5 years agoDrop rng and SystemTime calls from KeysManager
Matt Corallo [Thu, 18 Jul 2019 23:51:12 +0000 (19:51 -0400)]
Drop rng and SystemTime calls from KeysManager

They were only used for ensuring generated keys were globally
unique (ie in case the user opened the same seed at a different
time, we need generated keys to be globally unique).

Instead, we let the user specify a time in secs/nanos, and provide
a precise meaning for the user to understand.

5 years agoMerge pull request #348 from ariard/2019-07-upfront-shutdown-script
Matt Corallo [Mon, 22 Jul 2019 21:35:55 +0000 (21:35 +0000)]
Merge pull request #348 from ariard/2019-07-upfront-shutdown-script

Implement option_upfront_shutdown_script on both sides

5 years agoTest option_upfront_shutdown_script
Antoine Riard [Thu, 11 Jul 2019 20:14:36 +0000 (16:14 -0400)]
Test option_upfront_shutdown_script

5 years agoPass UserConfig to node creation test utilities
Antoine Riard [Thu, 11 Jul 2019 18:30:11 +0000 (14:30 -0400)]
Pass UserConfig to node creation test utilities

We way want more granularity on the set of user opt-in features at
a given time, specially with new 1.1 spec features

5 years agoPass LocalFeatures flag to channel creation test utilities
Antoine Riard [Thu, 11 Jul 2019 18:02:48 +0000 (14:02 -0400)]
Pass LocalFeatures flag to channel creation test utilities

We may want more granularity on the set of features activated at
a given time, specially with new 1.1 spec features

5 years agoImplement option_upfront_shutdown_script user-side
Antoine Riard [Tue, 9 Jul 2019 18:44:17 +0000 (14:44 -0400)]
Implement option_upfront_shutdown_script user-side

We use user config to decide to commit to closing script
in open_channel/accept_channel messages. We don't check
that other peer supporting the option as including
script without other peer public support is borne by
the protocol. If user opt-out, following protocol and
due to the fact we always signal, we provide a zero-length
script

5 years agoSupport option_upfront_shutdown_script for local peer
Antoine Riard [Tue, 9 Jul 2019 17:00:15 +0000 (13:00 -0400)]
Support option_upfront_shutdown_script for local peer

Track shutdown_pubkey of peer at open/accept_channel messages

Fix encoding_init test

5 years agoProvide peer local_features to handle_open_channel/accept_channel
Antoine Riard [Tue, 9 Jul 2019 18:38:30 +0000 (14:38 -0400)]
Provide peer local_features to handle_open_channel/accept_channel

Peer may send us a shutdown_scriptpubkey in open_channel or
accept_channel messages. Before to enforce this policy on channel
closing, we want to be sure that our peer has opt-in to it.

Extend LocalFeatures new method visibilty from crate to public
for fuzz tests

5 years agoMerge pull request #336 from ariard/2019-04-in-flight-txn-tracking-clean
Matt Corallo [Fri, 19 Jul 2019 22:02:25 +0000 (18:02 -0400)]
Merge pull request #336 from ariard/2019-04-in-flight-txn-tracking-clean

2019 04 in flight txn tracking clean

5 years agoImplement dynamic height timer for bump candidates txn
Antoine Riard [Thu, 18 Jul 2019 21:27:48 +0000 (17:27 -0400)]
Implement dynamic height timer for bump candidates txn

We must adapt our delay between two bumps of claim txn in respect
to the timelock encumbering the targeted outpoint. If HTLC or
revoked output is near to expire, we should try to get our claim
in every block. If it's reasonably in the future, we may give us
more latency to bump

5 years agoAdd in-flight claim-tx tracking
Antoine Riard [Sun, 31 Mar 2019 02:12:55 +0000 (22:12 -0400)]
Add in-flight claim-tx tracking

When we generate a justice tx, a htlc tx on remote commitment or
a htlc tx on local commitment we track them until first conf.

5 years agoAdd more comments about timelock assumptions and security model
Antoine Riard [Thu, 18 Jul 2019 22:50:03 +0000 (18:50 -0400)]
Add more comments about timelock assumptions and security model

Rename HTLC_FAIL_ANTI_REORG_DELAY to ANTI_REORG_DELAY because
we are going to rely on it also to remove bump candidates outpoint
from tracker after claim get enough depth.

Rename HTLC_FAIL_TIMEOUT_BLOCKS to LATENCY_GRACE_PERIOD_BLOCKS because
it's carrying more meaningfully that we are doing a favor to our
peer instead of ruthlessly enforcing the contract.

CLTV_EXPIRY_DELTA should be > to LATENCY_GRACE_PERIOD_BLOCKS +
+CLTV_CLAIM_BUFFER + ANTI_REORG_DELAY + LATENCY_GRACE_PERIOD_BLOCKS
When we reached height + LATENCY_GRACE_PERIOD_BLOCKS and we have pending
unsolved outbound HTLC, we fail onchain with
our local commitment tx. At this point we expect to get in chain in a
worst-case delay of CLTV_CLAIM_BUFFER. When our HTLC-timeout is
confirmed with ANTI_REORG_DELAY we may safely fail backward the
corresponding inbound output.

5 years agoMerge pull request #340 from TheBlueMatt/2019-06-channeldetails-fields
Matt Corallo [Fri, 19 Jul 2019 03:56:22 +0000 (23:56 -0400)]
Merge pull request #340 from TheBlueMatt/2019-06-channeldetails-fields

Add balance and is_live fields to ChannelDetails

5 years agoMerge pull request #351 from TheBlueMatt/2019-07-no-instant
Matt Corallo [Fri, 19 Jul 2019 00:55:41 +0000 (20:55 -0400)]
Merge pull request #351 from TheBlueMatt/2019-07-no-instant

Drop system clock calls for PendingHTLCsForwardable events.

5 years agoDrop system clock calls for PendingHTLCsForwardable events. 2019-07-no-instant
Matt Corallo [Thu, 18 Jul 2019 22:13:28 +0000 (18:13 -0400)]
Drop system clock calls for PendingHTLCsForwardable events.

Instead, return a Duration and let the user do the work of waiting.
This is one of only a handful of steps to make us
mostly-syscall-free, at least enough to run in WASM according to
elichai.

5 years agoDrop time_created in HTLCAwaitingACK::AddHTLC (we can use the CLTV)
Matt Corallo [Thu, 18 Jul 2019 22:07:27 +0000 (18:07 -0400)]
Drop time_created in HTLCAwaitingACK::AddHTLC (we can use the CLTV)

5 years agoAdd balance and is_live fields to ChannelDetails 2019-06-channeldetails-fields
Matt Corallo [Sat, 1 Jun 2019 16:11:27 +0000 (12:11 -0400)]
Add balance and is_live fields to ChannelDetails

5 years agoMove htlc_updated_waiting_threshold_conf to an OnchainEvent model
Antoine Riard [Sun, 31 Mar 2019 01:56:51 +0000 (21:56 -0400)]
Move htlc_updated_waiting_threshold_conf to an OnchainEvent model

We need also to track claim tx until their maturation to know
when we may safely remove them from could-be-bumped-txn buffer

5 years agoAdd block_disconnecting tests to cancel HTLC failure updates
Antoine Riard [Sat, 9 Feb 2019 02:43:56 +0000 (21:43 -0500)]
Add block_disconnecting tests to cancel HTLC failure updates

Add test_sweep_outbound_htlc_failure_update

5 years agoFail back dust HTLC of local commitment tx after enough confirmations
Antoine Riard [Thu, 7 Feb 2019 01:28:55 +0000 (20:28 -0500)]
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

5 years agoDelay failure of non-dust HTLC-outputs until solving timeout tx matures
Antoine Riard [Thu, 7 Feb 2019 01:02:38 +0000 (20:02 -0500)]
Delay failure of non-dust HTLC-outputs until solving timeout tx matures

Fix tests broken by introduced change

5 years agoImplement block_disconnect for pruning of waiting-conf HTLC updates
Antoine Riard [Tue, 5 Feb 2019 02:21:11 +0000 (21:21 -0500)]
Implement block_disconnect for pruning of waiting-conf HTLC updates

Modify ChainListener API by adding height field to block_disconnect

5 years agoTrack HTLC-failure trigger tx until anti-reorg delay reached
Antoine Riard [Fri, 31 May 2019 00:54:02 +0000 (20:54 -0400)]
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

5 years agoAdd log_trace on to_remote/to_local inclusion in commitment tx
Antoine Riard [Wed, 3 Jul 2019 15:15:12 +0000 (11:15 -0400)]
Add log_trace on to_remote/to_local inclusion in commitment tx

5 years agoMerge pull request #346 from ariard/log_trace_remote_local_outp
Matt Corallo [Wed, 3 Jul 2019 22:18:18 +0000 (18:18 -0400)]
Merge pull request #346 from ariard/log_trace_remote_local_outp

Add log_trace on to_remote/to_local inclusion in commitment tx

5 years agoAdd log_trace on to_remote/to_local inclusion in commitment tx
Antoine Riard [Wed, 3 Jul 2019 15:15:12 +0000 (11:15 -0400)]
Add log_trace on to_remote/to_local inclusion in commitment tx

5 years agoMerge pull request #341 from TheBlueMatt/2019-06-fuzz-crash-fee-sub
Matt Corallo [Mon, 1 Jul 2019 20:05:47 +0000 (16:05 -0400)]
Merge pull request #341 from TheBlueMatt/2019-06-fuzz-crash-fee-sub

Gracefully handle fee-larger-than-claimed-value in ChannelMonitor

5 years agoGracefully handle fee-larger-than-claimed-value in ChannelMonitor 2019-06-fuzz-crash-fee-sub
Matt Corallo [Fri, 14 Jun 2019 22:45:38 +0000 (18:45 -0400)]
Gracefully handle fee-larger-than-claimed-value in ChannelMonitor

This resulted in a full_stack_target failure as we overflow during
subtraction otherwise.

Instead, we try lower and lower fee estimator confirmation targets
until we find one low enough, or discard the transaction. We should
be able to handle this much cleaner, but for now this at least gets
the fuzzer working again.

5 years agoMerge pull request #339 from TheBlueMatt/2019-06-net-tokio-ver-bump
Matt Corallo [Sat, 1 Jun 2019 13:06:39 +0000 (09:06 -0400)]
Merge pull request #339 from TheBlueMatt/2019-06-net-tokio-ver-bump

Add subcrate that implements network socket handling with Tokio, bump to 0.0.9

5 years agoBump version to 0.0.9 to get current master fixes uploaded. 2019-06-net-tokio-ver-bump
Matt Corallo [Sat, 1 Jun 2019 11:04:18 +0000 (07:04 -0400)]
Bump version to 0.0.9 to get current master fixes uploaded.

5 years agoAdd subcrate that implements network socket handling with Tokio
Matt Corallo [Sat, 1 Jun 2019 11:02:31 +0000 (07:02 -0400)]
Add subcrate that implements network socket handling with Tokio

This is still pretty raw and ist mostly just a straight move from
rust-lightning-bitcoinrpc, but first step is to get it there,
second is to actually make it actually safe to use.

5 years agoBump rust-bitcoin dep to 0.18
Matt Corallo [Sat, 1 Jun 2019 11:02:05 +0000 (07:02 -0400)]
Bump rust-bitcoin dep to 0.18

5 years agoMerge pull request #320 from TheBlueMatt/2019-03-chan-send-rewrite
Matt Corallo [Mon, 22 Apr 2019 21:32:24 +0000 (17:32 -0400)]
Merge pull request #320 from TheBlueMatt/2019-03-chan-send-rewrite

Rewrite Channel resend tracking to make it much more reliable

5 years agoMerge pull request #334 from ariard/2019-04-fee-estimation-monitor
Matt Corallo [Sun, 21 Apr 2019 23:44:58 +0000 (19:44 -0400)]
Merge pull request #334 from ariard/2019-04-fee-estimation-monitor

Add Fee Estimation in ChannelMonitor

5 years agoAssert that our weight prediction can't result in unspendable txn
Matt Corallo [Sun, 14 Apr 2019 20:13:44 +0000 (16:13 -0400)]
Assert that our weight prediction can't result in unspendable txn

5 years agoAdd unit test for get_witnesses_weight
Antoine Riard [Wed, 10 Apr 2019 22:56:22 +0000 (18:56 -0400)]
Add unit test for get_witnesses_weight

5 years agoAdd fee estimation in check_spend_remote_htlc
Antoine Riard [Tue, 9 Apr 2019 23:43:03 +0000 (19:43 -0400)]
Add fee estimation in check_spend_remote_htlc

5 years agoAdd FeeEstimator in ChannelMonitor
Antoine Riard [Tue, 9 Apr 2019 01:11:16 +0000 (21:11 -0400)]
Add FeeEstimator in ChannelMonitor

5 years agoMerge pull request #335 from TheBlueMatt/2019-04-330-nits
Matt Corallo [Wed, 10 Apr 2019 17:19:42 +0000 (13:19 -0400)]
Merge pull request #335 from TheBlueMatt/2019-04-330-nits

Make channel open confs configurable (and change from 12 to 6)

5 years agoMake channel open confs configurable (and change from 12 to 6) 2019-04-330-nits
Sebastian Geisler [Tue, 26 Mar 2019 19:16:20 +0000 (12:16 -0700)]
Make channel open confs configurable (and change from 12 to 6)

This fixes compatibility with c-lightning etc as they won't accept
a minimum_depth of 12.

5 years agoMerge pull request #332 from ariard/2019-03-option-serialize-channel-monitor
Matt Corallo [Wed, 10 Apr 2019 16:00:59 +0000 (12:00 -0400)]
Merge pull request #332 from ariard/2019-03-option-serialize-channel-monitor

Use more Writeable/Readable for Option<T> in ChannelMonitor serializer/deserializer

5 years agoUse more Writeable/Readable for Option<T> in ChannelMonitor
Antoine Riard [Wed, 10 Apr 2019 00:01:18 +0000 (20:01 -0400)]
Use more Writeable/Readable for Option<T> in ChannelMonitor

5 years agoMerge pull request #328 from dongcarl/fine
Matt Corallo [Wed, 3 Apr 2019 20:27:56 +0000 (16:27 -0400)]
Merge pull request #328 from dongcarl/fine

Add test for tie breaking when sorting outputs

5 years agoMerge pull request #329 from dongcarl/patch-1
Matt Corallo [Tue, 26 Mar 2019 15:58:55 +0000 (11:58 -0400)]
Merge pull request #329 from dongcarl/patch-1

Improve README usability