rust-lightning
4 years agoUpdate comments to be a bit more descriptive and fix english a bit 2019-11-396-english
Matt Corallo [Sat, 30 Nov 2019 01:38:03 +0000 (20:38 -0500)]
Update comments to be a bit more descriptive and fix english a bit

4 years agoAdd test_announce_disable_channels
Antoine Riard [Mon, 18 Nov 2019 05:43:49 +0000 (00:43 -0500)]
Add test_announce_disable_channels

4 years agoAdd timer_chan_freshness_every_min
Antoine Riard [Mon, 18 Nov 2019 05:43:13 +0000 (00:43 -0500)]
Add timer_chan_freshness_every_min

Latency/peer disconnection may trigger us to mark as disabled
some of our channels. After some time, if channels are still
disabled we need to broadcast ChannelUpdate to inform other network
peers about the uselessness of these channels.

4 years agoAdd UpdateStatus in Channel to track freshness of gossiped liveness.
Antoine Riard [Fri, 29 Nov 2019 06:39:33 +0000 (01:39 -0500)]
Add UpdateStatus in Channel to track freshness of gossiped liveness.

Added enum and method are only used in next commit.

4 years agoMerge pull request #399 from TheBlueMatt/2019-11-fuzz-top-level
Matt Corallo [Mon, 25 Nov 2019 21:19:23 +0000 (21:19 +0000)]
Merge pull request #399 from TheBlueMatt/2019-11-fuzz-top-level

Move fuzz to top level.

4 years agoMove fuzz to top level. 2019-11-fuzz-top-level
Matt Corallo [Fri, 22 Nov 2019 20:40:58 +0000 (15:40 -0500)]
Move fuzz to top level.

4 years agoMerge pull request #389 from valentinewallace/split-chain-watch-interface
Matt Corallo [Fri, 22 Nov 2019 18:26:44 +0000 (18:26 +0000)]
Merge pull request #389 from valentinewallace/split-chain-watch-interface

remove circular references in channelmanager and channelmonitor

4 years agochaininterface+multi: add filter_block and reentered to ChainWatchInterface
Valentine Wallace [Mon, 18 Nov 2019 21:40:05 +0000 (16:40 -0500)]
chaininterface+multi: add filter_block and reentered to ChainWatchInterface

Because filter_block takes a  and returns a list of s , we must add a lifetime to the ChainWatchInterface, which bubbles up in a lot of places. These places include adding a lifetime  to the Node struct, which causes a lot of rearranging tests so that variables don't go out of scope before the Node that owns them does.

4 years agochaininterface: add BlockNotifier struct
Valentine Wallace [Sat, 9 Nov 2019 01:12:13 +0000 (20:12 -0500)]
chaininterface: add BlockNotifier struct

Adding this struct will allow us to remove the circular reference
between ChainListeners and the ChainWatchInterface, because it
separates out the responsibility of notifying listeners about new
blocks from the responsibility of storing and retrieving watched
transactions.

4 years agomulti: remove listeners field and method from ChainWatchInterface
Valentine Wallace [Sat, 9 Nov 2019 01:12:13 +0000 (20:12 -0500)]
multi: remove listeners field and method from ChainWatchInterface

This includes the purpose of this PR, which is to remove the circular reference created by ChainListeners self-adding themselves to their ChainWatchInterface's `listeners` field.

4 years agoMerge pull request #397 from ariard/2019-11-doc-announce-sigs
Matt Corallo [Thu, 21 Nov 2019 03:11:46 +0000 (03:11 +0000)]
Merge pull request #397 from ariard/2019-11-doc-announce-sigs

Doc announce_sigs

4 years agoExtend test for announcement_sigs
Antoine Riard [Tue, 19 Nov 2019 23:03:05 +0000 (18:03 -0500)]
Extend test for announcement_sigs

4 years agoDocument our handling of announcement_sigs
Antoine Riard [Tue, 19 Nov 2019 22:48:22 +0000 (17:48 -0500)]
Document our handling of announcement_sigs

We may have in the future to rebroadcast announcement_sigs at
peer reconnection if this a burning issue as spec lacks
a acknowledgement mechanism.

4 years agoMerge pull request #379 from rrybarczyk/use-workspaces
Matt Corallo [Tue, 19 Nov 2019 01:52:13 +0000 (01:52 +0000)]
Merge pull request #379 from rrybarczyk/use-workspaces

Use workspaces to separate crates

4 years agoMerge branch 'master' of github.com:rust-bitcoin/rust-lightning into use-workspaces
RJ Rybarczyk [Mon, 18 Nov 2019 23:51:21 +0000 (23:51 +0000)]
Merge branch 'master' of github.com:rust-bitcoin/rust-lightning into use-workspaces

4 years agoUpdate travis file to accommodate workspaces
RJ Rybarczyk [Mon, 18 Nov 2019 22:01:34 +0000 (22:01 +0000)]
Update travis file to accommodate workspaces

4 years agoMerge pull request #395 from ariard/2019-11-expected-amt-claim-funds
Matt Corallo [Mon, 18 Nov 2019 23:08:33 +0000 (23:08 +0000)]
Merge pull request #395 from ariard/2019-11-expected-amt-claim-funds

Avoid probing attacks with same hash lower amounts

4 years agoAdd test_check_htlc_underpaying
Antoine Riard [Mon, 18 Nov 2019 04:52:49 +0000 (23:52 -0500)]
Add test_check_htlc_underpaying

4 years agoCheck expected amount in claim_funds
Antoine Riard [Thu, 14 Nov 2019 23:50:24 +0000 (18:50 -0500)]
Check expected amount in claim_funds

Require to specify expected amount so that we can claim only
payment for thhe correct amount, and reject payments for incorrect
amounts (which are probably middle nodes probing to break our privacy).

Send back incorrect_or_unknown_payments_details (PERM|15) to avoid
the probe node learning that final node is waiting a payment with
the routed hash.

4 years agoMerge branch 'master' of github.com:rust-bitcoin/rust-lightning into use-workspaces
RJ Rybarczyk [Mon, 18 Nov 2019 19:44:55 +0000 (19:44 +0000)]
Merge branch 'master' of github.com:rust-bitcoin/rust-lightning into use-workspaces

4 years agoMerge pull request #394 from TheBlueMatt/2019-11-broken-build
Matt Corallo [Fri, 15 Nov 2019 22:47:34 +0000 (22:47 +0000)]
Merge pull request #394 from TheBlueMatt/2019-11-broken-build

Fix broken build

4 years agoDrop needless mut 2019-11-broken-build
Matt Corallo [Fri, 15 Nov 2019 22:19:46 +0000 (17:19 -0500)]
Drop needless mut

4 years agoFix build broken by silent merge conflicts
Matt Corallo [Fri, 15 Nov 2019 22:19:26 +0000 (17:19 -0500)]
Fix build broken by silent merge conflicts

4 years agoMerge pull request #393 from ariard/2019-11-send-cmt-error-handling
Matt Corallo [Fri, 15 Nov 2019 21:58:37 +0000 (21:58 +0000)]
Merge pull request #393 from ariard/2019-11-send-cmt-error-handling

Fulfill error handling for send_commitment in processing htlcs forward

4 years agoMerge pull request #390 from ariard/2019-11-consistent-errors
Matt Corallo [Fri, 15 Nov 2019 21:57:36 +0000 (21:57 +0000)]
Merge pull request #390 from ariard/2019-11-consistent-errors

Make field error of ErrorPacket (former HandleError) mandatory

4 years agoMerge pull request #392 from ariard/2019-11-manager-init-height
Matt Corallo [Fri, 15 Nov 2019 21:38:04 +0000 (21:38 +0000)]
Merge pull request #392 from ariard/2019-11-manager-init-height

Add init height in ChannelManager constructor

4 years agoMake field error of LightingError mandatory
Antoine Riard [Tue, 5 Nov 2019 00:54:43 +0000 (19:54 -0500)]
Make field error of LightingError mandatory

We also fulfilled last empty ErrorAction:
- Router secp fail : IgnoreError
- processing error in Router : IgnoreError
- get_channel_update too early : IgnoreError

4 years agoAdd init height in ChannelManager constructor
Antoine Riard [Thu, 14 Nov 2019 22:41:17 +0000 (17:41 -0500)]
Add init height in ChannelManager constructor

4 years agoMerge pull request #391 from ariard/2019-11-fix-preimage-collision-onchain
Matt Corallo [Fri, 15 Nov 2019 19:20:43 +0000 (19:20 +0000)]
Merge pull request #391 from ariard/2019-11-fix-preimage-collision-onchain

Avoid claiming remote received HTLCs with side-learned preimage

4 years agoUse workspaces to separate crates
RJ Rybarczyk [Fri, 15 Nov 2019 02:44:30 +0000 (02:44 +0000)]
Use workspaces to separate crates

4 years agoFulfill error handling for send_commitment in processing htlcs forward
Antoine Riard [Thu, 14 Nov 2019 23:27:47 +0000 (18:27 -0500)]
Fulfill error handling for send_commitment in processing htlcs forward

4 years agoAdd test_duplicate_htlc_different_direction_onchain
Antoine Riard [Wed, 13 Nov 2019 00:33:27 +0000 (19:33 -0500)]
Add test_duplicate_htlc_different_direction_onchain

4 years agoAvoid claiming remote received HTLCs with preimage
Antoine Riard [Wed, 13 Nov 2019 00:27:55 +0000 (19:27 -0500)]
Avoid claiming remote received HTLCs with preimage

In case of duplicate HTLCs with same hash going in opposite
directions we may learn preimage of offered one, but we shouldn't
claim received one to avoid invalidation of combined claim.
The received HTLC is going to be claimed by a timeout tx at
timelock expiration.

Fix #337

4 years agoRename HandleError to LightningError to stress already-processed error
Antoine Riard [Tue, 5 Nov 2019 00:09:51 +0000 (19:09 -0500)]
Rename HandleError to LightningError to stress already-processed error

4 years agoMerge pull request #386 from TheBlueMatt/2019-10-useless-lints
Matt Corallo [Mon, 28 Oct 2019 21:36:39 +0000 (21:36 +0000)]
Merge pull request #386 from TheBlueMatt/2019-10-useless-lints

Disable some useless lints

4 years agoDisable some useless lints 2019-10-useless-lints
Matt Corallo [Mon, 28 Oct 2019 19:21:12 +0000 (15:21 -0400)]
Disable some useless lints

4 years agoMerge pull request #384 from ariard/2019-10-clean-warnings
Matt Corallo [Sat, 26 Oct 2019 20:59:55 +0000 (20:59 +0000)]
Merge pull request #384 from ariard/2019-10-clean-warnings

Remove useless test framework warnings

4 years agoRemove useless test framework warnings
Antoine Riard [Sat, 26 Oct 2019 00:20:41 +0000 (20:20 -0400)]
Remove useless test framework warnings

4 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

4 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

4 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

4 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

4 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

4 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

4 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

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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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.

4 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

4 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

4 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).

4 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.

4 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.

4 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

4 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

4 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

4 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

4 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.

4 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.

4 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

4 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

4 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.

4 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.

4 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.

4 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.

4 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

4 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)

4 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.

4 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

4 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)

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

4 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.

4 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.

4 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

4 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

4 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.

4 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.

4 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)

4 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

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

4 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.

4 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

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

4 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

4 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

4 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

4 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