From a3330acecfd50611a3b3ab09dc4dd564603bd4dc Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 17 Dec 2021 00:32:28 +0000 Subject: [PATCH 1/4] Remove trailing whitespace in the FeeEstimator interface --- lightning/src/chain/chaininterface.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightning/src/chain/chaininterface.rs b/lightning/src/chain/chaininterface.rs index cca51e31851..9a45a88ffe4 100644 --- a/lightning/src/chain/chaininterface.rs +++ b/lightning/src/chain/chaininterface.rs @@ -41,10 +41,10 @@ pub enum ConfirmationTarget { pub trait FeeEstimator { /// Gets estimated satoshis of fee required per 1000 Weight-Units. /// - /// Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later + /// Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later /// round-downs don't put us below 1 satoshi-per-byte). /// - /// This method can be implemented with the following unit conversions: + /// This method can be implemented with the following unit conversions: /// * max(satoshis-per-byte * 250, 253) /// * max(satoshis-per-kbyte / 4, 253) fn get_est_sat_per_1000_weight(&self, confirmation_target: ConfirmationTarget) -> u32; From 8f9d1c9a8cd9af70b7d93cf905ce3ba1352787c5 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 17 Dec 2021 01:49:39 +0000 Subject: [PATCH 2/4] Update CHANGELOG for 0.0.104 --- CHANGELOG.md | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80745291a0e..df1204e9bc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,107 @@ +# 0.0.104 - 2021-12-17 + +## API Updates + * A `PaymentFailed` event is now provided to indicate a payment has failed + fully. This event is generated either after + `ChannelManager::abandon_payment` is called for a given payment, or the + payment times out, and there are no further pending HTLCs for the payment. + This event should be used to detect payment failure instead of + `PaymentPathFailed::all_paths_failed`, unless no payment retries occur via + `ChannelManager::retry_payment` (#1202). + * Payment secrets are now generated deterministically using material from + the new `KeysInterface::get_inbound_payment_key_material` (#1177). + * A `PaymentPathSuccessful` event has been added to ease passing success info + to a scorer, along with a `Score::payment_path_successful` method to accept + such info (#1178, #1197). + * `Score::channel_penalty_msat` has additional arguments describing the + channel's capacity and the HTLC amount being sent over the channel (#1166). + * A new log level `Gossip` has been added, which is used for verbose + information generated during network graph sync. Enabling the + `max_level_trace` feature or ignoring `Gossip` log entries reduces log + growth during initial start up from many GiB to several MiB (#1145). + * The `allow_wallclock_use` feature has been removed in favor of only using + the `std` and `no-std` features (#1212). + * `NetworkGraph` can now remove channels that we haven't heard updates for in + two weeks with `NetworkGraph::remove_stale_channels{,with_time}`. The first + is called automatically if a `NetGraphMsgHandler` is passed to + `BackgroundProcessor::start` (#1212). + * `InvoicePayer::pay_pubkey` was added to enable sending "keysend" payments to + supported recipients, using the `InvoicePayer` to handle retires (#1160). + * `user_payment_id` has been removed from `PaymentPurpose`, and + `ChannelManager::create_inbound_payment{,_for_hash}` (#1180). + * Updated documentation for several `ChannelManager` functions to remove stale + references to panics which no longer occur (#1201). + * The `Score` and `LockableScore` objects have moved into the + `routing::scoring` module instead of being in the `routing` module (#1166). + * The `Time` parameter to `ScorerWithTime` is no longer longer exposed, + instead being fixed based on the `std`/`no-std` feature (#1184). + * `ChannelDetails::balance_msat` was added to fetch a channel's balance + without subtracting the reserve values, lining up with on-chain claim amounts + less on-chain fees (#1203). + * An explicit `UserConfig::accept_inbound_channels` flag is now provided, + removing the need to set `min_funding_satoshis` to > 21 million BTC (#1173). + * Inbound channels that fail to see the funding transaction confirm within + 2016 blocks are automatically force-closed with + `ClosureReason::FundingTimedOut` (#1083). + * We now accept a channel_reserve value of 0 from counterparties, as it is + insecure for our counterparty but not us (#1163). + * `NetAddress::OnionV2` parsing was removed as version 2 onion services are no + longer supported in modern Tor (#1204). + * Generation and signing of anchor outputs is now supported in the + `KeysInterface`, though no support for them exists in the channel itself (#1176) + +## Bug Fixes + * Fixed a race condition in `InvoicePayer` where paths may be retried after + the retry count has been exceeded. In this case the + `Event::PaymentPathFailed::all_paths_failed` field is not a reliable payment + failure indicator. There was no acceptable alternative indicator, + `Event::PaymentFailed` as been added to provide one (#1202). + * Reduced the blocks-before-timeout we expect of outgoing HTLCs before + refusing to forward. This check was overly strict and resulted in refusing + to forward som HTLCs to a next hop that had a lower security threshold than + us (#1119). + * LDK no longer attempt to update the channel fee for outbound channels when + we cannot afford the new fee. This could have caused force-closure by our + channel counterparty (#1054). + * Fixed several bugs which may have prevented the reliable broadcast of our + own channel announcements and updates (#1169). + * Fixed a rare bug which may have resulted in spurious route finding failures + when using last-hop hints and MPP with large value payments (#1168). + * `KeysManager::spend_spendable_outputs` no longer adds a change output that + is below the dust threshold for non-standard change scripts (#1131). + * Fixed a minor memory leak when attempting to send a payment that fails due + to an error when updating the `ChannelMonitor` (#1143). + * Fixed a bug where a `FeeEstimator` that returns values rounded to the next + sat/vbyte may result in force-closures (#1208). + * Handle MPP timeout HTLC error codes, instead of considering the recipient to + have sent an invalid error, removing them from the network graph (#1148) + +## Serialization Compatibility + * All above new events/fields are ignored by prior clients. All above new + events/fields are not present when reading objects serialized by prior + versions of the library. + * Payment secrets are now generated deterministically. This reduces the memory + footprint for inbound payments, however, newly-generated inbound payments + using `ChannelManager::create_inbound_payment{,_for_hash}` will not be + receivable using versions prior to 0.0.104. + `ChannelManager::create_inbound_payment{,_for_hash}_legacy` are provided for + backwards compatibility (#1177). + * `PaymentPurpose::InvoicePayment::user_payment_id` will be 0 when reading + objects written with 0.0.104 when read by 0.0.103 and previous (#1180). + +In total, this release features 51 files changed, 5356 insertions, 2238 +deletions in 107 commits from 9 authors, in alphabetical order: + * Antoine Riard + * Conor Okus + * Devrandom + * Duncan Dean + * Elias Rohrer + * Jeffrey Czyz + * Ken Sedgwick + * Matt Corallo + * Valentine Wallace + + # 0.0.103 - 2021-11-02 ## API Updates From ec86e2a1a7a1b2cd680a46e2bdd4274dd39bb78c Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 17 Dec 2021 21:28:24 +0000 Subject: [PATCH 3/4] Bump versions to 0.0.104/invoice 0.12 --- lightning-background-processor/Cargo.toml | 10 +++++----- lightning-block-sync/Cargo.toml | 4 ++-- lightning-invoice/Cargo.toml | 6 +++--- lightning-net-tokio/Cargo.toml | 4 ++-- lightning-persister/Cargo.toml | 6 +++--- lightning/Cargo.toml | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lightning-background-processor/Cargo.toml b/lightning-background-processor/Cargo.toml index 531678325eb..0056393dd25 100644 --- a/lightning-background-processor/Cargo.toml +++ b/lightning-background-processor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lightning-background-processor" -version = "0.0.103" +version = "0.0.104" authors = ["Valentine Wallace "] license = "MIT OR Apache-2.0" repository = "http://github.com/rust-bitcoin/rust-lightning" @@ -11,9 +11,9 @@ edition = "2018" [dependencies] bitcoin = "0.27" -lightning = { version = "0.0.103", path = "../lightning", features = ["std"] } -lightning-persister = { version = "0.0.103", path = "../lightning-persister" } +lightning = { version = "0.0.104", path = "../lightning", features = ["std"] } +lightning-persister = { version = "0.0.104", path = "../lightning-persister" } [dev-dependencies] -lightning = { version = "0.0.103", path = "../lightning", features = ["_test_utils"] } -lightning-invoice = { version = "0.11.0", path = "../lightning-invoice" } +lightning = { version = "0.0.104", path = "../lightning", features = ["_test_utils"] } +lightning-invoice = { version = "0.12.0", path = "../lightning-invoice" } diff --git a/lightning-block-sync/Cargo.toml b/lightning-block-sync/Cargo.toml index e9d5f52816e..ae6eb58258d 100644 --- a/lightning-block-sync/Cargo.toml +++ b/lightning-block-sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lightning-block-sync" -version = "0.0.103" +version = "0.0.104" authors = ["Jeffrey Czyz", "Matt Corallo"] license = "MIT OR Apache-2.0" repository = "http://github.com/rust-bitcoin/rust-lightning" @@ -15,7 +15,7 @@ rpc-client = [ "serde", "serde_json", "chunked_transfer" ] [dependencies] bitcoin = "0.27" -lightning = { version = "0.0.103", path = "../lightning" } +lightning = { version = "0.0.104", path = "../lightning" } tokio = { version = "1.0", features = [ "io-util", "net", "time" ], optional = true } serde = { version = "1.0", features = ["derive"], optional = true } serde_json = { version = "1.0", optional = true } diff --git a/lightning-invoice/Cargo.toml b/lightning-invoice/Cargo.toml index 010becc2719..71648b3c84d 100644 --- a/lightning-invoice/Cargo.toml +++ b/lightning-invoice/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lightning-invoice" description = "Data structures to parse and serialize BOLT11 lightning invoices" -version = "0.11.0" +version = "0.12.0" authors = ["Sebastian Geisler "] documentation = "https://docs.rs/lightning-invoice/" license = "MIT OR Apache-2.0" @@ -10,11 +10,11 @@ readme = "README.md" [dependencies] bech32 = "0.8" -lightning = { version = "0.0.103", path = "../lightning" } +lightning = { version = "0.0.104", path = "../lightning" } secp256k1 = { version = "0.20", features = ["recovery"] } num-traits = "0.2.8" bitcoin_hashes = "0.10" [dev-dependencies] hex = "0.3" -lightning = { version = "0.0.103", path = "../lightning", features = ["_test_utils"] } +lightning = { version = "0.0.104", path = "../lightning", features = ["_test_utils"] } diff --git a/lightning-net-tokio/Cargo.toml b/lightning-net-tokio/Cargo.toml index ad3dc008e6a..0a763f09fef 100644 --- a/lightning-net-tokio/Cargo.toml +++ b/lightning-net-tokio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lightning-net-tokio" -version = "0.0.103" +version = "0.0.104" authors = ["Matt Corallo"] license = "MIT OR Apache-2.0" repository = "https://github.com/rust-bitcoin/rust-lightning/" @@ -12,7 +12,7 @@ edition = "2018" [dependencies] bitcoin = "0.27" -lightning = { version = "0.0.103", path = "../lightning" } +lightning = { version = "0.0.104", path = "../lightning" } tokio = { version = "1.0", features = [ "io-util", "macros", "rt", "sync", "net", "time" ] } [dev-dependencies] diff --git a/lightning-persister/Cargo.toml b/lightning-persister/Cargo.toml index ef8631059c9..7c32b6cf4a1 100644 --- a/lightning-persister/Cargo.toml +++ b/lightning-persister/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lightning-persister" -version = "0.0.103" +version = "0.0.104" authors = ["Valentine Wallace", "Matt Corallo"] license = "MIT OR Apache-2.0" repository = "https://github.com/rust-bitcoin/rust-lightning/" @@ -13,11 +13,11 @@ unstable = ["lightning/unstable"] [dependencies] bitcoin = "0.27" -lightning = { version = "0.0.103", path = "../lightning" } +lightning = { version = "0.0.104", path = "../lightning" } libc = "0.2" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3", features = ["winbase"] } [dev-dependencies] -lightning = { version = "0.0.103", path = "../lightning", features = ["_test_utils"] } +lightning = { version = "0.0.104", path = "../lightning", features = ["_test_utils"] } diff --git a/lightning/Cargo.toml b/lightning/Cargo.toml index b80e0a5b1b7..1234cd5c05c 100644 --- a/lightning/Cargo.toml +++ b/lightning/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lightning" -version = "0.0.103" +version = "0.0.104" authors = ["Matt Corallo"] license = "MIT OR Apache-2.0" repository = "https://github.com/rust-bitcoin/rust-lightning/" From 27d5c7a2106f163f1c0df462db4ca6247f891af2 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 17 Dec 2021 22:38:46 +0000 Subject: [PATCH 4/4] Swap around generic argument ordering in DefaultRouter for bindings The bindings generation really should support default generic types in where clauses, but currently does not. To avoid needing to add support during the current release process, we simply swap around the arguments to move them to the first <> instead of the where. --- lightning-invoice/src/utils.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lightning-invoice/src/utils.rs b/lightning-invoice/src/utils.rs index 5918753ae1c..53fdc13f2fc 100644 --- a/lightning-invoice/src/utils.rs +++ b/lightning-invoice/src/utils.rs @@ -97,20 +97,20 @@ where } /// A [`Router`] implemented using [`find_route`]. -pub struct DefaultRouter where G: Deref, L::Target: Logger { +pub struct DefaultRouter, L: Deref> where L::Target: Logger { network_graph: G, logger: L, } -impl DefaultRouter where G: Deref, L::Target: Logger { +impl, L: Deref> DefaultRouter where L::Target: Logger { /// Creates a new router using the given [`NetworkGraph`] and [`Logger`]. pub fn new(network_graph: G, logger: L) -> Self { Self { network_graph, logger } } } -impl Router for DefaultRouter -where G: Deref, L::Target: Logger { +impl, L: Deref, S: Score> Router for DefaultRouter +where L::Target: Logger { fn find_route( &self, payer: &PublicKey, params: &RouteParameters, _payment_hash: &PaymentHash, first_hops: Option<&[&ChannelDetails]>, scorer: &S