]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
2 years agoAllow nodes to be avoided during pathfinding
Elias Rohrer [Sat, 18 Jun 2022 14:24:37 +0000 (16:24 +0200)]
Allow nodes to be avoided during pathfinding

Users may want to - for whatever reasons - prevent payments to be routed
over certain nodes. This change therefore allows to add `NodeId`s to a
list of banned nodes, which then will be avoided during path finding.

2 years agoMerge pull request #1518 from valentinewallace/2022-06-OMs-prefactor
Matt Corallo [Tue, 21 Jun 2022 23:13:37 +0000 (16:13 -0700)]
Merge pull request #1518 from valentinewallace/2022-06-OMs-prefactor

Onion messages v1 pre-refactor

2 years agoEnable simultaneous deserialization+decryption of a ChaChaPoly stream
Valentine Wallace [Tue, 14 Jun 2022 20:28:45 +0000 (16:28 -0400)]
Enable simultaneous deserialization+decryption of a ChaChaPoly stream

In the upcoming onion messages PR, this will allow us to avoid decrypting onion
message encrypted data in an intermediate Vec before decoding it. Instead we
decrypt and decode it at the same time using this new ChaChaPolyReadAdapter object.

In doing so, we need to adapt the decode_tlv_stream macro such that it will
decode a LengthReadableArgs, which is a new trait as well. This trait is
necessary because ChaChaPoly needs to know the total length ahead of time to
separate out the tag at the end.

2 years agoMerge pull request #1556 from danielgranhao/2022-06-improve-docs
valentinewallace [Tue, 21 Jun 2022 19:59:31 +0000 (15:59 -0400)]
Merge pull request #1556 from danielgranhao/2022-06-improve-docs

Clarify description of get_node_secret() method

2 years agochacha20poly1305: enable simultaneous writing+encryption
Valentine Wallace [Tue, 14 Jun 2022 20:13:34 +0000 (16:13 -0400)]
chacha20poly1305: enable simultaneous writing+encryption

In the upcoming onion messages PR, this will allow us to avoid encoding onion
message encrypted data into an intermediate Vec before encrypting it.  Instead
we encode and encrypt at the same time using this new ChaChaPolyWriteAdapter object.

2 years agoMerge pull request #1486 from TheBlueMatt/2022-05-revoked-txn-edge-cases
Matt Corallo [Tue, 21 Jun 2022 18:47:15 +0000 (11:47 -0700)]
Merge pull request #1486 from TheBlueMatt/2022-05-revoked-txn-edge-cases

Fix two edge cases in handling of counterparty revoked commitment txn

2 years agoChange description of get_node_secret()
Daniel Granhão [Tue, 21 Jun 2022 16:38:57 +0000 (17:38 +0100)]
Change description of get_node_secret()

2 years agoMerge pull request #1548 from NicolaLS/serde-module
Matt Corallo [Tue, 21 Jun 2022 16:20:38 +0000 (09:20 -0700)]
Merge pull request #1548 from NicolaLS/serde-module

add feature for Invoice ser/de

2 years agoDon't fail HTLCs in revoked commitment txn until we spend them 2022-05-revoked-txn-edge-cases
Matt Corallo [Sat, 30 Apr 2022 20:30:00 +0000 (20:30 +0000)]
Don't fail HTLCs in revoked commitment txn until we spend them

When we see a counterparty revoked commitment transaction on-chain
we shouldn't immediately queue up HTLCs present in it for
resolution until we have spent the HTLC outputs in some kind of
claim transaction.

In order to do so, we first have to change the
`fail_unbroadcast_htlcs!()` call to provide it with the HTLCs which
are present in the (revoked) commitment transaction which was
broadcast. However, this is not sufficient - because all of those
HTLCs had their `HTLCSource` removed when the commitment
transaction was revoked, we also have to update
`fail_unbroadcast_htlcs` to check the payment hash and amount when
the `HTLCSource` is `None`.

Somewhat surprisingly, several tests actually explicitly tested for
the old behavior, which required amending to pass with the new
changes.

Finally, this adds a debug assertion when writing `ChannelMonitor`s
to ensure `HTLCSource`s do not leak.

2 years agoMerge pull request #1527 from wpaulino/update-htlc-relay-policy
Matt Corallo [Tue, 21 Jun 2022 16:02:29 +0000 (09:02 -0700)]
Merge pull request #1527 from wpaulino/update-htlc-relay-policy

Expose API to update a channel's ChannelConfig

2 years agoUse new Channel::update_config method to update base fee in test
Wilmer Paulino [Wed, 15 Jun 2022 23:34:30 +0000 (16:34 -0700)]
Use new Channel::update_config method to update base fee in test

2 years agoAllow forwarding HTLCs that were constructed for previous config
Wilmer Paulino [Wed, 15 Jun 2022 23:33:23 +0000 (16:33 -0700)]
Allow forwarding HTLCs that were constructed for previous config

This is mostly motivated by the fact that payments may happen while the
latest `ChannelUpdate` indicating our new `ChannelConfig` is still
propagating throughout the network. By temporarily allowing the previous
config, we can help reduce payment failures across the network.

2 years agoTrack previous ChannelConfig and expire after enough ticks
Wilmer Paulino [Thu, 16 Jun 2022 23:24:42 +0000 (16:24 -0700)]
Track previous ChannelConfig and expire after enough ticks

We do this to prevent payment failures while the `ChannelUpdate` for the
new `ChannelConfig` still propagates throughout the network. In a follow
up commit, we'll honor forwarding HTLCs that were constructed based on
either the previous or current `ChannelConfig`.

To handle expiration (when we should stop allowing the previous config),
we rely on the ChannelManager's `timer_tick_occurred` method. After
enough ticks, the previous config is cleared from memory, and only the
current config applies moving forward.

2 years agoExpose API to update a channel's ChannelConfig
Wilmer Paulino [Tue, 14 Jun 2022 23:41:32 +0000 (16:41 -0700)]
Expose API to update a channel's ChannelConfig

A new `update_channel_config` method is exposed on the `ChannelManger`
to update the `ChannelConfig` for a set of channels atomically. New
`ChannelUpdate` events are generated for each eligible channel.

Note that as currently implemented, a buggy and/or
auto-policy-management client could spam the network with updates as
there is no rate-limiting in place. This could already be done with
`broadcast_node_announcement`, though users are less inclined to update
that as frequently as its data is mostly static.

2 years agoExpose ChannelConfig within ChannelDetails
Wilmer Paulino [Tue, 14 Jun 2022 23:40:12 +0000 (16:40 -0700)]
Expose ChannelConfig within ChannelDetails

As we prepare to expose an API to update a channel's ChannelConfig,
we'll also want to expose this struct to consumers such that they have
insights into the current ChannelConfig applied for each channel.

2 years agoadd optional dependency on serde to implement serialize/deserialize for invoice
NicolaLS [Thu, 16 Jun 2022 11:52:49 +0000 (13:52 +0200)]
add optional dependency on serde to implement serialize/deserialize for invoice

2 years agoMerge pull request #1549 from tnull/2022-06-scorer-query-interface
Jeffrey Czyz [Sat, 18 Jun 2022 17:59:27 +0000 (12:59 -0500)]
Merge pull request #1549 from tnull/2022-06-scorer-query-interface

Provide simple interface to query estimated min/max liquidity

2 years agoProvide simple interface to query est. liquidity
Elias Rohrer [Sat, 18 Jun 2022 12:40:36 +0000 (14:40 +0200)]
Provide simple interface to query est. liquidity

2 years agoonion_utils: add next_hop_packet_pubkey method
Valentine Wallace [Fri, 27 May 2022 00:36:32 +0000 (17:36 -0700)]
onion_utils: add next_hop_packet_pubkey method

To get the next hop's packet's pubkey. This will be used to DRY onion message
forwarding in the upcoming Onion Messages PR #1503

2 years agoMerge pull request #1532 from ariard/2022-06-scaleup-far-away
Matt Corallo [Fri, 17 Jun 2022 00:27:27 +0000 (17:27 -0700)]
Merge pull request #1532 from ariard/2022-06-scaleup-far-away

Scale up CLTV_FAR_FAR_AWAY to 2 weeks of blocks

2 years agoScale up CLTV_FAR_FAR_AWAY to 2 weeks of blocks
Antoine Riard [Thu, 9 Jun 2022 21:53:37 +0000 (17:53 -0400)]
Scale up CLTV_FAR_FAR_AWAY to 2 weeks of blocks

2 years agoMerge pull request #1544 from jkczyz/2022-06-node-alias
Matt Corallo [Thu, 16 Jun 2022 13:34:08 +0000 (06:34 -0700)]
Merge pull request #1544 from jkczyz/2022-06-node-alias

Define `NodeAlias` struct and `Display` impl

2 years agoMerge pull request #1531 from ariard/2022-06-fee-sniping
Matt Corallo [Thu, 16 Jun 2022 13:12:29 +0000 (06:12 -0700)]
Merge pull request #1531 from ariard/2022-06-fee-sniping

Funding_tx: add anti-fee sniping recommendation and check if final

2 years agoDefine NodeAlias struct and Display impl
Jeffrey Czyz [Thu, 9 Jun 2022 20:17:01 +0000 (15:17 -0500)]
Define NodeAlias struct and Display impl

Provide a wrapper struct for 32-byte node aliases, which implements
Display for printing. Support the UTF-8 character encoding, but replace
control characters and terminate at the first null character. Fall back
to ASCII if the byte sequence is an invalid encoding.

2 years agoCorrect handling of reorg'd-out revoked counterparty transactions
Matt Corallo [Tue, 17 May 2022 00:12:20 +0000 (00:12 +0000)]
Correct handling of reorg'd-out revoked counterparty transactions

Previously, while processing a confirmed revoked counterparty
commitment transaction, we'd populate `OnchainEvent`s for live
HTLCs with a `txid` source of the txid of the latest counterparty
commitment transactions, not the confirmed revoked one. This meant
that, if the user is using `transaction_unconfirmed` to notify us
of reorg information, we'd end up not removing the entry if the
revoked commitment transaction was reorg'd out. This would
ultimately cause us to spuriously resolve the HTLC(s) as the chain
advanced, even though we were doing so based on a now-reorged-out
transaction.

Luckily the fix is simple - set the correct txid in the
`OnchainEventEntry`. We also take this opportunity to update
logging in a few places with the txid of the transaction causing an
event.

2 years agoMerge pull request #1541 from jkczyz/2022-06-nit-follow-ups
Matt Corallo [Wed, 15 Jun 2022 09:52:35 +0000 (02:52 -0700)]
Merge pull request #1541 from jkczyz/2022-06-nit-follow-ups

2 years agoRecommend funding_tx to apply anti-fee sniping
Antoine Riard [Thu, 9 Jun 2022 21:40:42 +0000 (17:40 -0400)]
Recommend funding_tx to apply anti-fee sniping

2 years agoCheck if funding transaction is final for propagation
Antoine Riard [Thu, 9 Jun 2022 21:31:04 +0000 (17:31 -0400)]
Check if funding transaction is final for propagation

If the funding transaction is timelocked beyond the next block of
our best known chain tip, return an APIError instead of silently
failing at broadcast attempt.

2 years agoMerge pull request #1540 from wpaulino/rename-config-fields
Matt Corallo [Tue, 14 Jun 2022 11:57:02 +0000 (04:57 -0700)]
Merge pull request #1540 from wpaulino/rename-config-fields

2 years agoRemove unnecessary identifiers from match pattern
Jeffrey Czyz [Mon, 13 Jun 2022 23:25:15 +0000 (18:25 -0500)]
Remove unnecessary identifiers from match pattern

2 years agoReplace Arc with reference in some tests
Jeffrey Czyz [Mon, 13 Jun 2022 22:25:10 +0000 (17:25 -0500)]
Replace Arc with reference in some tests

2 years agoFix grammar in BackgroundProcessor::start docs
Jeffrey Czyz [Mon, 13 Jun 2022 23:18:19 +0000 (18:18 -0500)]
Fix grammar in BackgroundProcessor::start docs

2 years agoRename UserConfig and LegacyChannelConfig fields
Wilmer Paulino [Mon, 13 Jun 2022 19:53:56 +0000 (12:53 -0700)]
Rename UserConfig and LegacyChannelConfig fields

The current names aren't very clear to what each field represents, this
commit aims to improve that.

2 years agoMerge pull request #1526 from tnull/2022-06-fix-minimal-value-contrib
Matt Corallo [Mon, 13 Jun 2022 17:50:19 +0000 (10:50 -0700)]
Merge pull request #1526 from tnull/2022-06-fix-minimal-value-contrib

Fix per-path minimal value contribution during route finding

2 years agoAdd failure test cases for `max_mpp_path_count`.
Elias Rohrer [Thu, 9 Jun 2022 12:59:44 +0000 (14:59 +0200)]
Add failure test cases for `max_mpp_path_count`.

2 years agoFix min. contrib. depending on `max_mpp_path_count`
Elias Rohrer [Tue, 7 Jun 2022 08:21:45 +0000 (10:21 +0200)]
Fix min. contrib. depending on `max_mpp_path_count`

2 years agoMerge pull request #1514 from mattfaltyn/issue438
Matt Corallo [Mon, 13 Jun 2022 11:19:02 +0000 (04:19 -0700)]
Merge pull request #1514 from mattfaltyn/issue438

2 years agoMerge pull request #1529 from wpaulino/move-channel-config-static-fields
Matt Corallo [Mon, 13 Jun 2022 11:04:23 +0000 (04:04 -0700)]
Merge pull request #1529 from wpaulino/move-channel-config-static-fields

Move ChannelConfig static fields to ChannelHandshakeConfig

2 years agoDocument better optional features
Matt [Sun, 12 Jun 2022 18:31:53 +0000 (11:31 -0700)]
Document better optional features

2 years agoMerge pull request #1535 from TheBlueMatt/2022-06-108-ugh v0.0.108
Matt Corallo [Fri, 10 Jun 2022 16:44:11 +0000 (09:44 -0700)]
Merge pull request #1535 from TheBlueMatt/2022-06-108-ugh

Cut 0.0.108

2 years agoUpdate crate versions to 0.0.108/invoice 0.16 2022-06-108-ugh
Matt Corallo [Fri, 10 Jun 2022 10:41:51 +0000 (10:41 +0000)]
Update crate versions to 0.0.108/invoice 0.16

2 years agoUpdate CHANGELOG for 0.0.108
Matt Corallo [Fri, 10 Jun 2022 10:42:15 +0000 (10:42 +0000)]
Update CHANGELOG for 0.0.108

2 years agoMerge pull request #1534 from tnull/2022-06-check-release-build
Matt Corallo [Fri, 10 Jun 2022 14:51:41 +0000 (07:51 -0700)]
Merge pull request #1534 from tnull/2022-06-check-release-build

Check release build in CI

2 years agoCheck release build profile in CI
Elias Rohrer [Fri, 10 Jun 2022 08:45:57 +0000 (10:45 +0200)]
Check release build profile in CI

So far, CI did not check the code in the `release` build profile, which
could result in some things not getting caught. To fix this, we now
implement a new CI job that runs checks in the `release` profile.

Switch to stable toolchain.

2 years agoMerge pull request #1533 from lexe-tech/fix-release
Matt Corallo [Fri, 10 Jun 2022 10:34:09 +0000 (03:34 -0700)]
Merge pull request #1533 from lexe-tech/fix-release

Fix `lightning-background-processor` release build

2 years agoFix lightning-background-processor release build
Max Fang [Fri, 10 Jun 2022 05:58:26 +0000 (22:58 -0700)]
Fix lightning-background-processor release build

2 years agoIntroduce LegacyChannelConfig to remain backwards compatible
Wilmer Paulino [Thu, 9 Jun 2022 21:01:56 +0000 (14:01 -0700)]
Introduce LegacyChannelConfig to remain backwards compatible

ChannelConfig now has its static fields removed. We introduce a new
LegacyChannelConfig struct that maintains the serialization as
previously defined by ChannelConfig to remain backwards compatible with
clients running 0.0.107 and earlier.

2 years agoMove commit_upfront_shutdown_pubkey to ChannelHandshakeConfig
Wilmer Paulino [Wed, 8 Jun 2022 22:40:58 +0000 (15:40 -0700)]
Move commit_upfront_shutdown_pubkey to ChannelHandshakeConfig

As like the previous commit, `commit_upfront_shutdown_pubkey` is another
static field that cannot change after the initial channel handshake. We
therefore move it out from its existing place in `ChannelConfig`.

2 years agoMove announced_channel to ChannelHandshakeConfig
Wilmer Paulino [Thu, 9 Jun 2022 23:11:15 +0000 (16:11 -0700)]
Move announced_channel to ChannelHandshakeConfig

In the near future, we plan to allow users to update their
`ChannelConfig` after the initial channel handshake. In order to reuse
the same struct and expose it to users, we opt to move out all static
fields that cannot be updated after the initial channel handshake.

2 years agoMerge pull request #1496 from TheBlueMatt/2022-05-macro-function-bonus
Arik Sosman [Thu, 9 Jun 2022 16:10:27 +0000 (12:10 -0400)]
Merge pull request #1496 from TheBlueMatt/2022-05-macro-function-bonus

Make `expect_payment_failed_conditions` a function

2 years agoMake `expect_payment_failed_conditions` a function 2022-05-macro-function-bonus
Matt Corallo [Fri, 20 May 2022 02:56:59 +0000 (02:56 +0000)]
Make `expect_payment_failed_conditions` a function

This reduces macro generated code in tests a good bit, and moves us
one step further away from using macros everywhere when we don't
need to.

2 years agoMerge pull request #1513 from TheBlueMatt/2022-06-fix-fuzz-nonbug
valentinewallace [Thu, 9 Jun 2022 01:32:22 +0000 (18:32 -0700)]
Merge pull request #1513 from TheBlueMatt/2022-06-fix-fuzz-nonbug

Do not panic on early tx broadcasts in fuzzing

2 years agoMerge pull request #1524 from ViktorTigerstrom/2022-06-update-fail-holding-cell-htlcs...
Matt Corallo [Thu, 9 Jun 2022 00:12:20 +0000 (17:12 -0700)]
Merge pull request #1524 from ViktorTigerstrom/2022-06-update-fail-holding-cell-htlcs-args

Pass `counterparty_node_id` to `fail_holding_cell_htlcs`

2 years agoMerge pull request #1525 from jkczyz/2022-05-release-0.0.107 v0.0.107
Matt Corallo [Wed, 8 Jun 2022 23:44:03 +0000 (16:44 -0700)]
Merge pull request #1525 from jkczyz/2022-05-release-0.0.107

Cut 0.0.107

2 years agoBump crate versions to 0.0.107/invoice 0.15
Jeffrey Czyz [Mon, 6 Jun 2022 18:49:29 +0000 (13:49 -0500)]
Bump crate versions to 0.0.107/invoice 0.15

2 years agoUpdate CHANGELOG for 0.0.107
Jeffrey Czyz [Mon, 30 May 2022 18:30:49 +0000 (11:30 -0700)]
Update CHANGELOG for 0.0.107

2 years agoPass `peer_node_id` to `fail_holding_cell_htlcs`
Viktor Tigerström [Mon, 6 Jun 2022 18:38:28 +0000 (20:38 +0200)]
Pass `peer_node_id` to `fail_holding_cell_htlcs`

2 years agoAdd lightning-rapid-gossip-sync to README
Jeffrey Czyz [Wed, 8 Jun 2022 04:50:07 +0000 (23:50 -0500)]
Add lightning-rapid-gossip-sync to README

2 years agoMerge pull request #1517 from jkczyz/2022-06-gossip-sync-enum
Matt Corallo [Tue, 7 Jun 2022 10:17:29 +0000 (03:17 -0700)]
Merge pull request #1517 from jkczyz/2022-06-gossip-sync-enum

Support only one `GossipSync` in `BackgroundProcessor`

2 years agoSupport only one GossipSync in BackgroundProcessor
Jeffrey Czyz [Thu, 2 Jun 2022 21:48:32 +0000 (14:48 -0700)]
Support only one GossipSync in BackgroundProcessor

BackgroundProcessor can take an optional P2PGossipSync and an optional
RapidGossipSync, but doing so may be easy to misuse. Each has a
reference to a NetworkGraph, which could be different between the two,
but only one is actually used.

Instead, allow passing one object wrapped in a GossipSync enum. Also,
fix a bug where the NetworkGraph is not persisted on shutdown if only a
RapidGossipSync is given.

2 years agoImplement EventHandler for NetworkGraph
Jeffrey Czyz [Fri, 3 Jun 2022 05:59:14 +0000 (22:59 -0700)]
Implement EventHandler for NetworkGraph

Instead of implementing EventHandler for P2PGossipSync, implement it on
NetworkGraph. This allows RapidGossipSync to handle events, too, by
delegating to its NetworkGraph.

2 years agoParameterize NetworkGraph with Logger
Jeffrey Czyz [Sat, 4 Jun 2022 04:35:37 +0000 (21:35 -0700)]
Parameterize NetworkGraph with Logger

P2PGossipSync logs before delegating to NetworkGraph in its
EventHandler. In order to share this handling with RapidGossipSync,
NetworkGraph needs to take a logger so that it can implement
EventHandler instead.

2 years agoMerge pull request #1501 from tnull/2022-05-mention-compat-level
Matt Corallo [Sat, 4 Jun 2022 00:14:01 +0000 (17:14 -0700)]
Merge pull request #1501 from tnull/2022-05-mention-compat-level

Mention backwards compatibility in CONTRIBUTING.

2 years agoMove Secp256k1 context to NetworkGraph
Jeffrey Czyz [Fri, 3 Jun 2022 04:37:59 +0000 (21:37 -0700)]
Move Secp256k1 context to NetworkGraph

P2PGossipSync has a Secp256k1 context field, which it only uses to pass
to NetworkGraph methods. Move the field to NetworkGraph so other callers
don't need to pass in a Secp256k1 context.

2 years agoMerge pull request #1159 from jkczyz/2021-11-network-gossip
Matt Corallo [Thu, 2 Jun 2022 23:53:32 +0000 (16:53 -0700)]
Merge pull request #1159 from jkczyz/2021-11-network-gossip

Rename network-related types

2 years agoMove network_graph.rs to gossip.rs
Jeffrey Czyz [Thu, 2 Jun 2022 19:53:34 +0000 (12:53 -0700)]
Move network_graph.rs to gossip.rs

The routing::network_graph module contains a few structs related to p2p
gossip. So renaming the module to 'gossip' seems more appropriate.

2 years agoRename NetGraphMsgHandler to P2PGossipSync
Jeffrey Czyz [Wed, 1 Jun 2022 17:28:34 +0000 (10:28 -0700)]
Rename NetGraphMsgHandler to P2PGossipSync

NetGraphMsgHandler implements RoutingMessageHandler to handle gossip
messages defined in BOLT 7 and maintains a view of the network by
updating NetworkGraph. Rename it to P2PGossipSync, which better
describes its purpose, and to contrast with RapidGossipSync.

2 years agoRename ChannelClosed to ChannelFailure
Jeffrey Czyz [Fri, 5 Nov 2021 17:55:25 +0000 (12:55 -0500)]
Rename ChannelClosed to ChannelFailure

A NetworkUpdate indicating ChannelClosed actually corresponds to a
channel failure as described in BOLT 4:

0x2000 (NODE): node failure (otherwise channel)

Rename the enum variant to ChannelFailure and rename NetworkGraph
methods close_channel_from_update and fail_node to channel_failed and
node_failed, respectively.

2 years agoUpdate missed references to get_route in docs
Jeffrey Czyz [Thu, 4 Nov 2021 14:57:53 +0000 (09:57 -0500)]
Update missed references to get_route in docs

2 years agoFix build warnings
Jeffrey Czyz [Wed, 1 Jun 2022 21:50:40 +0000 (14:50 -0700)]
Fix build warnings

2 years agoMerge pull request #1505 from tnull/2022-05-support-0conf-channeltype
valentinewallace [Thu, 2 Jun 2022 20:02:25 +0000 (13:02 -0700)]
Merge pull request #1505 from tnull/2022-05-support-0conf-channeltype

Support `ZeroConf` channel type.

2 years agoMerge pull request #1433 from arik-so/2022-04-rapid-sync-bg-processor
Jeffrey Czyz [Thu, 2 Jun 2022 19:10:00 +0000 (14:10 -0500)]
Merge pull request #1433 from arik-so/2022-04-rapid-sync-bg-processor

Allow indication to BackgroundProcessor that graph sync is pending

2 years agoCreate separate timer for scorer persistence in background processor
Arik Sosman [Wed, 1 Jun 2022 23:25:30 +0000 (16:25 -0700)]
Create separate timer for scorer persistence in background processor

2 years agoIndicate ongoing rapid sync to background processor.
Arik Sosman [Wed, 1 Jun 2022 22:26:07 +0000 (15:26 -0700)]
Indicate ongoing rapid sync to background processor.

Create a wrapper struct for rapid gossip sync that can be passed to
BackgroundProcessor's start method, allowing it to only start pruning
the network graph upon rapid gossip sync's completion.

2 years agoDo not panic on early tx broadcasts in fuzzing 2022-06-fix-fuzz-nonbug
Matt Corallo [Thu, 2 Jun 2022 03:37:16 +0000 (03:37 +0000)]
Do not panic on early tx broadcasts in fuzzing

If the user broadcasts a funding transaction before the
counterparty provides a `funding_signed` we will panic in
`check_get_channel_ready`. This is expected - the user did
something which may lead to loss of funds, and we *really* need to
let them know.

However, the fuzzer can do this and we shouldn't treat it as a bug,
its a totally expected panic. Thus, we disable the panic in fuzz.

Thanks to Chaincode for providing fuzzing resources which managed
to hit this panic.

2 years agoImplement `ZeroConf` feature.
Elias Rohrer [Thu, 2 Jun 2022 00:05:17 +0000 (17:05 -0700)]
Implement `ZeroConf` feature.

2 years agoMerge pull request #1512 from tnull/2022-05-remove-deprecated-scorer
Jeffrey Czyz [Wed, 1 Jun 2022 23:29:15 +0000 (18:29 -0500)]
Merge pull request #1512 from tnull/2022-05-remove-deprecated-scorer

Remove previously deprecated `Scorer`

2 years agoMerge pull request #1509 from shamardy/main
Matt Corallo [Wed, 1 Jun 2022 22:54:46 +0000 (15:54 -0700)]
Merge pull request #1509 from shamardy/main

Update regex to 1.5.6

2 years agoRemove previously deprecated `Scorer`
Elias Rohrer [Fri, 27 May 2022 01:20:05 +0000 (18:20 -0700)]
Remove previously deprecated `Scorer`

2 years agoMerge pull request #1504 from TheBlueMatt/2022-05-pub-io
Jeffrey Czyz [Wed, 1 Jun 2022 20:57:18 +0000 (15:57 -0500)]
Merge pull request #1504 from TheBlueMatt/2022-05-pub-io

Re-export `core2::io` or `std::io` depending on feature flags

2 years agoMerge pull request #1511 from justinmoon/repository
Jeffrey Czyz [Wed, 1 Jun 2022 20:52:20 +0000 (15:52 -0500)]
Merge pull request #1511 from justinmoon/repository

Add 'repository' to lightning-invoice's Cargo.toml

2 years agoAdd 'repository' to lightning-invoice's Cargo.toml
Justin Moon [Wed, 1 Jun 2022 18:17:16 +0000 (13:17 -0500)]
Add 'repository' to lightning-invoice's Cargo.toml

2 years agoUpdate regex to 1.5.6
shamardy [Wed, 1 Jun 2022 15:25:15 +0000 (17:25 +0200)]
Update regex to 1.5.6

2 years agoMerge pull request #1500 from arik-so/2022-05-network-graph-rapid-sync-timestamp
Arik Sosman [Tue, 31 May 2022 18:57:18 +0000 (11:57 -0700)]
Merge pull request #1500 from arik-so/2022-05-network-graph-rapid-sync-timestamp

Add optional last_rapid_gossip_sync_timestamp field to NetworkGraph to enable optimized differential rapid syncing.

2 years agoMerge pull request #1506 from tnull/2022-05-rename-funding-locked
Matt Corallo [Tue, 31 May 2022 17:48:09 +0000 (10:48 -0700)]
Merge pull request #1506 from tnull/2022-05-rename-funding-locked

Rename `FundingLocked` to `ChannelReady`.

2 years agoAdd optional last_rapid_gossip_sync_timestamp field to NetworkGraph to enable optimiz...
Arik Sosman [Fri, 27 May 2022 00:58:57 +0000 (17:58 -0700)]
Add optional last_rapid_gossip_sync_timestamp field to NetworkGraph to enable optimized differental rapid syncing.

2 years agoRe-export `core2::io` or `std::io` depending on feature flags 2022-05-pub-io
Matt Corallo [Mon, 30 May 2022 17:50:02 +0000 (17:50 +0000)]
Re-export `core2::io` or `std::io` depending on feature flags

This is useful in bindings as the `lightning::io` module is used in
the public interface, but also useful for users who want to refer
to the `io` as used in lightning irrespective of the feature flags.

2 years agoRename `FundingLocked` to `ChannelReady`.
Elias Rohrer [Mon, 30 May 2022 21:39:04 +0000 (14:39 -0700)]
Rename `FundingLocked` to `ChannelReady`.

2 years agoMerge pull request #1434 from TheBlueMatt/2022-04-robust-payment-claims
valentinewallace [Mon, 30 May 2022 17:05:01 +0000 (10:05 -0700)]
Merge pull request #1434 from TheBlueMatt/2022-04-robust-payment-claims

Improve Robustness of Inbound MPP Claims Across Restart

2 years agoChange `Event` `amt` fields to `amount_msat` for clarity 2022-04-robust-payment-claims
Matt Corallo [Sat, 28 May 2022 00:27:14 +0000 (00:27 +0000)]
Change `Event` `amt` fields to `amount_msat` for clarity

2 years agoMention backwards compatibility in CONTRIBUTING.
Elias Rohrer [Fri, 27 May 2022 23:55:27 +0000 (16:55 -0700)]
Mention backwards compatibility in CONTRIBUTING.

2 years agoAdd internal docs for ChannelMonitor::payment_preimages
Matt Corallo [Fri, 22 Apr 2022 17:58:19 +0000 (17:58 +0000)]
Add internal docs for ChannelMonitor::payment_preimages

2 years agoDrop return value from `fail_htlc_backwards`, clarify docs
Matt Corallo [Tue, 19 Apr 2022 22:06:50 +0000 (22:06 +0000)]
Drop return value from `fail_htlc_backwards`, clarify docs

`ChannelManager::fail_htlc_backwards`' bool return value is quite
confusing - just because it returns false doesn't mean the payment
wasn't (already) failed. Worse, in some race cases around shutdown
where a payment was claimed before an unclean shutdown and then
retried on startup, `fail_htlc_backwards` could return true even
though (a duplicate copy of the same payment) was claimed, but the
claim event has not been seen by the user yet.

While its possible to use it correctly, its somewhat confusing to
have a return value at all, and definitely lends itself to misuse.

Instead, we should push users towards a model where they don't care
if `fail_htlc_backwards` succeeds - either they've locally marked
the payment as failed (prior to seeing any `PaymentReceived`
events) and will fail any attempts to pay it, or they have not and
the payment is still receivable until its timeout time is reached.

We can revisit this decision based on user feedback, but will need
to very carefully document the potential failure modes here if we
do.

2 years agoDo additional pre-flight checks before claiming a payment
Matt Corallo [Tue, 19 Apr 2022 21:46:44 +0000 (21:46 +0000)]
Do additional pre-flight checks before claiming a payment

As additional sanity checks, before claiming a payment, we check
that we have the full amount available in `claimable_htlcs` that
the payment should be for. Concretely, this prevents one
somewhat-absurd edge case where a user may receive an MPP payment,
wait many *blocks* before claiming it, allowing us to fail the
pending HTLCs and the sender to retry some subset of the payment
before we go to claim. More generally, this is just good
belt-and-suspenders against any edge cases we may have missed.

2 years agoProvide a redundant `Event::PaymentClaimed` on restart if needed
Matt Corallo [Wed, 4 May 2022 18:12:09 +0000 (18:12 +0000)]
Provide a redundant `Event::PaymentClaimed` on restart if needed

If we crashed during a payment claim and then detected a partial
claim on restart, we should ensure the user is aware that the
payment has been claimed. We do so here by using the new
partial-claim detection logic to create a `PaymentClaimed` event.

2 years agoAdd a `PaymentClaimed` event to indicate a payment was claimed
Matt Corallo [Mon, 18 Apr 2022 20:12:15 +0000 (20:12 +0000)]
Add a `PaymentClaimed` event to indicate a payment was claimed

This replaces the return value of `claim_funds` with an event. It
does not yet change behavior in any material way.

2 years agoMerge pull request #1401 from TheBlueMatt/2022-02-0conf-round-two
Matt Corallo [Fri, 27 May 2022 23:54:52 +0000 (16:54 -0700)]
Merge pull request #1401 from TheBlueMatt/2022-02-0conf-round-two

Zero Conf Channels

2 years agoAdd note about SCID collisions in `PaymentPathFailed` 2022-02-0conf-round-two
Matt Corallo [Wed, 4 May 2022 02:34:10 +0000 (02:34 +0000)]
Add note about SCID collisions in `PaymentPathFailed`

This isn't specific to 0-conf but is useful for users to note as
the network moves towards more SCID aliases.

2 years agoAdd test of 0conf channels getting the funding transaction reorg'd
Matt Corallo [Mon, 2 May 2022 15:23:52 +0000 (15:23 +0000)]
Add test of 0conf channels getting the funding transaction reorg'd

In a previous version of the 0-conf code we did not correctly
handle 0-conf channels getting the funding transaction reorg'd out
(and the real SCID possibly changing on us).

2 years agoCorrectly handle sending announcement sigs on public 0conf channels
Matt Corallo [Fri, 1 Apr 2022 21:29:59 +0000 (21:29 +0000)]
Correctly handle sending announcement sigs on public 0conf channels