Skip to content

Commit f61987a

Browse files
committed
added Error::new() to OnionV2 and V3 with error message. Also changed the the Iter type into a vec::IntoIter
2 parents e8c0cbe + 0f2dab8 commit f61987a

File tree

33 files changed

+662
-102
lines changed

33 files changed

+662
-102
lines changed

CHANGELOG.md

+175
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,178 @@
1+
# 0.0.117 - Oct 3, 2023 - "Everything but the Twelve Sinks"
2+
3+
## API Updates
4+
* `ProbabilisticScorer`'s internal models have been substantially improved,
5+
including better decaying (#1789), a more granular historical channel
6+
liquidity tracker (#2176) and a now-default option to make our estimate for a
7+
channel's current liquidity nonlinear in the channel's capacity (#2547). In
8+
total, these changes should result in improved payment success rates at the
9+
cost of slightly worse routefinding performance.
10+
* Support for custom TLVs for recipients of HTLCs has been added (#2308).
11+
* Support for generating transactions for third-party watchtowers has been
12+
added to `ChannelMonitor/Update`s (#2337).
13+
* `KVStorePersister` has been replaced with a more generic and featureful
14+
`KVStore` interface (#2472).
15+
* A new `MonitorUpdatingPersister` is provided which wraps a `KVStore` and
16+
implements `Persist` by writing differential updates rather than full
17+
`ChannelMonitor`s (#2359).
18+
* Batch funding of outbound channels is now supported using the new
19+
`ChannelManager::batch_funding_transaction_generated` method (#2486).
20+
* `ChannelManager::send_preflight_probes` has been added to probe a payment's
21+
potential paths while a user is providing approval for a payment (#2534).
22+
* Fully asynchronous `ChannelMonitor` updating is available as an alpha
23+
preview. There remain a few known but incredibly rare race conditions which
24+
may lead to loss of funds (#2112, #2169, #2562).
25+
* `ChannelMonitorUpdateStatus::PermanentFailure` has been removed in favor of a
26+
new `ChannelMonitorUpdateStatus::UnrecoverableError`. The new variant panics
27+
on use, rather than force-closing a channel in an unsafe manner, which the
28+
previous variant did (#2562). Rather than panicking with the new variant,
29+
users may wish to use the new asynchronous `ChannelMonitor` updating using
30+
`ChannelMonitorUpdateStatus::InProgress`.
31+
* `RouteParameters::max_total_routing_fee_msat` was added to limit the fees
32+
paid when routing, defaulting to 1% + 50sats when using the new
33+
`from_payment_params_and_value` constructor (#2417, #2603, #2604).
34+
* Implementations of `UtxoSource` are now provided in `lightning-block-sync`.
35+
Those running with a full node should use this to validate gossip (#2248).
36+
* `LockableScore` now supports read locking for parallel routefinding (#2197).
37+
* `ChannelMonitor::get_spendable_outputs` was added to allow for re-generation
38+
of `SpendableOutputDescriptor`s for a channel after they were provided via
39+
`Event::SpendableOutputs` (#2609, #2624).
40+
* `[u8; 32]` has been replaced with a `ChannelId` newtype for chan ids (#2485).
41+
* `NetAddress` was renamed `SocketAddress` (#2549) and `FromStr` impl'd (#2134)
42+
* For `no-std` users, `parse_onion_address` was added which creates a
43+
`NetAddress` from a "...onion" string and port (#2134, #2633).
44+
* HTLC information is now provided in `Event::PaymentClaimed::htlcs` (#2478).
45+
* The success probability used in historical penalties when scoring is now
46+
available via `historical_estimated_payment_success_probability` (#2466).
47+
* `RecentPaymentDetails::*::payment_id` has been added (#2567).
48+
* `Route` now contains a `RouteParameters` rather than a `PaymentParameters`,
49+
tracking the original arguments passed to routefinding (#2555).
50+
* `Balance::*::claimable_amount_satoshis` was renamed `amount_satoshis` (#2460)
51+
* `*Features::set_*_feature_bit` have been added for non-custom flags (#2522).
52+
* `channel_id` was added to `SpendableOutputs` events (#2511).
53+
* `counterparty_node_id` and `channel_capacity_sats` were added to
54+
`ChannelClosed` events (#2387).
55+
* `ChannelMonitor` now implements `Clone` for `Clone`able signers (#2448).
56+
* `create_onion_message` was added to build an onion message (#2583, #2595).
57+
* `HTLCDescriptor` now implements `Writeable`/`Readable` (#2571).
58+
* `SpendableOutputDescriptor` now implements `Hash` (#2602).
59+
* `MonitorUpdateId` now implements `Debug` (#2594).
60+
* `Payment{Hash,Id,Preimage}` now implement `Display` (#2492).
61+
* `NodeSigner::sign_bolt12_invoice{,request}` were added for future use (#2432)
62+
63+
## Backwards Compatibility
64+
* Users migrating to the new `KVStore` can use a concatentation of
65+
`[{primary_namespace}/[{secondary_namespace}/]]{key}` to build a key
66+
compatible with the previous `KVStorePersister` interface (#2472).
67+
* Downgrading after receipt of a payment with custom HTLC TLVs may result in
68+
unintentionally accepting payments with TLVs you do not understand (#2308).
69+
* `Route` objects (including pending payments) written by LDK versions prior
70+
to 0.0.117 won't be retryable after being deserialized by LDK 0.0.117 or
71+
above (#2555).
72+
* Users of the `MonitorUpdatingPersister` can upgrade seamlessly from the
73+
default `KVStore` `Persist` implementation, however the stored
74+
`ChannelMonitor`s are deliberately unreadable by the default `Persist`. This
75+
ensures the correct downgrade procedure is followed, which is: (#2359)
76+
* First, make a backup copy of all channel state,
77+
* then ensure all `ChannelMonitorUpdate`s stored are fully applied to the
78+
relevant `ChannelMonitor`,
79+
* finally, write each full `ChannelMonitor` using your new `Persist` impl.
80+
81+
## Bug Fixes
82+
* Anchor channels which were closed by a counterparty broadcasting its
83+
commitment transaction (i.e. force-closing) would previously not generate a
84+
`SpendableOutputs` event for our `to_remote` (i.e. non-HTLC-encumbered)
85+
balance. Those with such balances available should fetch the missing
86+
`SpendableOutputDescriptor`s using the new
87+
`ChannelMonitor::get_spendable_outputs` method (#2605).
88+
* Anchor channels may result in spurious or missing `Balance` entries for HTLC
89+
balances (#2610).
90+
* `ChannelManager::send_spontaneous_payment_with_retry` spuriously did not
91+
provide the recipient with enough information to claim the payment, leading
92+
to all spontaneous payments failing (#2475).
93+
`send_spontaneous_payment_with_route` was unaffected.
94+
* The `keysend` feature on node announcements was spuriously un-set in 0.0.112
95+
and has been re-enabled (#2465).
96+
* Fixed several races which could lead to deadlock when force-closing a channel
97+
(#2597). These races have not been seen in production.
98+
* The `ChannelManager` is persisted substantially less when it has not changed,
99+
leading to substantially less I/O traffic for it (#2521, #2617).
100+
* Passing new block data to `ChainMonitor` no longer results in all other
101+
monitor operations being blocked until it completes (#2528).
102+
* When retrying payments, any excess amount sent to the recipient in order to
103+
meet an `htlc_minimum` constraint on the path is now no longer included in
104+
the amount we send in the retry (#2575).
105+
* Several edge cases in route-finding around HTLC minimums were fixed which
106+
could have caused invalid routes or panics when built with debug assertions
107+
(#2570, #2575).
108+
* Several edge cases in route-finding around HTLC minimums and route hints
109+
were fixed which would spuriously result in no route found (#2575, #2604).
110+
* The `user_channel_id` passed to `SignerProvider::generate_channel_keys_id`
111+
for inbound channels is now correctly using the one passed to
112+
`ChannelManager::accept_inbound_channel` rather than a default value (#2428).
113+
* Users of `impl_writeable_tlv_based!` no longer have use requirements (#2506).
114+
* No longer force-close channels when counterparties send a `channel_update`
115+
with a bogus `htlc_minimum_msat`, which LND users can manually build (#2611).
116+
117+
## Node Compatibility
118+
* LDK now ignores `error` messages generated by LND in response to a
119+
`shutdown` message, avoiding force-closes due to LND bug 6039. This may
120+
lead to non-trivial bandwidth usage with LND peers exhibiting this bug
121+
during the cooperative shutdown process (#2507).
122+
123+
## Security
124+
0.0.117 fixes several loss-of-funds vulnerabilities in anchor output channels,
125+
support for which was added in 0.0.116, in reorg handling, and when accepting
126+
channel(s) from counterparties which are miners.
127+
* When a counterparty broadcasts their latest commitment transaction for a
128+
channel with anchor outputs, we'd previously fail to build claiming
129+
transactions against any HTLC outputs in that transaction. This could lead
130+
to loss of funds if the counterparty is able to eventually claim the HTLC
131+
after a timeout (#2606).
132+
* Anchor channels HTLC claims on-chain previously spent the entire value of any
133+
HTLCs as fee, which has now been fixed (#2587).
134+
* If a channel is closed via an on-chain commitment transaction confirmation
135+
with a pending outbound HTLC in the commitment transaction, followed by a
136+
reorg which replaces the confirmed commitment transaction with a different
137+
(but non-revoked) commitment transaction, all before we learn the payment
138+
preimage for this HTLC, we may previously have not generated a proper
139+
claiming transaction for the HTLC's value (#2623).
140+
* 0.0.117 now correctly handles channels for which our counterparty funded the
141+
channel with a coinbase transaction. As such transactions are not spendable
142+
until they've reached 100 confirmations, this could have resulted in
143+
accepting HTLC(s) which are not enforcible on-chain (#1924).
144+
145+
In total, this release features 121 files changed, 20477 insertions, 8184
146+
deletions in 381 commits from 27 authors, in alphabetical order:
147+
* Alec Chen
148+
* Allan Douglas R. de Oliveira
149+
* Antonio Yang
150+
* Arik Sosman
151+
* Chris Waterson
152+
* David Caseria
153+
* DhananjayPurohit
154+
* Dom Zippilli
155+
* Duncan Dean
156+
* Elias Rohrer
157+
* Erik De Smedt
158+
* Evan Feenstra
159+
* Gabor Szabo
160+
* Gursharan Singh
161+
* Jeffrey Czyz
162+
* Joseph Goulden
163+
* Lalitmohansharma1
164+
* Matt Corallo
165+
* Rachel Malonson
166+
* Sergi Delgado Segura
167+
* Valentine Wallace
168+
* Vladimir Fomene
169+
* Willem Van Lint
170+
* Wilmer Paulino
171+
* benthecarman
172+
* jbesraa
173+
* optout
174+
175+
1176
# 0.0.116 - Jul 21, 2023 - "Anchoring the Roadmap"
2177

3178
## API Updates

fuzz/src/chanmon_consistency.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl chain::Watch<TestChannelSigner> for TestChainMonitor {
155155
};
156156
let deserialized_monitor = <(BlockHash, channelmonitor::ChannelMonitor<TestChannelSigner>)>::
157157
read(&mut Cursor::new(&map_entry.get().1), (&*self.keys, &*self.keys)).unwrap().1;
158-
deserialized_monitor.update_monitor(update, &&TestBroadcaster{}, &FuzzEstimator { ret_val: atomic::AtomicU32::new(253) }, &self.logger).unwrap();
158+
deserialized_monitor.update_monitor(update, &&TestBroadcaster{}, &&FuzzEstimator { ret_val: atomic::AtomicU32::new(253) }, &self.logger).unwrap();
159159
let mut ser = VecWriter(Vec::new());
160160
deserialized_monitor.write(&mut ser).unwrap();
161161
map_entry.insert((update.update_id, ser.0));

lightning-background-processor/Cargo.toml

+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[package]
22
name = "lightning-background-processor"
3+
<<<<<<< HEAD
34
version = "0.0.117-rc1"
5+
=======
6+
version = "0.0.117"
7+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
48
authors = ["Valentine Wallace <vwallace@protonmail.com>"]
59
license = "MIT OR Apache-2.0"
610
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -22,6 +26,7 @@ default = ["std"]
2226

2327
[dependencies]
2428
bitcoin = { version = "0.29.0", default-features = false }
29+
<<<<<<< HEAD
2530
lightning = { version = "0.0.117-rc1", path = "../lightning", default-features = false }
2631
lightning-rapid-gossip-sync = { version = "0.0.117-rc1", path = "../lightning-rapid-gossip-sync", default-features = false }
2732

@@ -30,3 +35,13 @@ tokio = { version = "1.14", features = [ "macros", "rt", "rt-multi-thread", "syn
3035
lightning = { version = "0.0.117-rc1", path = "../lightning", features = ["_test_utils"] }
3136
lightning-invoice = { version = "0.25.0-rc1", path = "../lightning-invoice" }
3237
lightning-persister = { version = "0.0.117-rc1", path = "../lightning-persister" }
38+
=======
39+
lightning = { version = "0.0.117", path = "../lightning", default-features = false }
40+
lightning-rapid-gossip-sync = { version = "0.0.117", path = "../lightning-rapid-gossip-sync", default-features = false }
41+
42+
[dev-dependencies]
43+
tokio = { version = "1.14", features = [ "macros", "rt", "rt-multi-thread", "sync", "time" ] }
44+
lightning = { version = "0.0.117", path = "../lightning", features = ["_test_utils"] }
45+
lightning-invoice = { version = "0.25.0", path = "../lightning-invoice" }
46+
lightning-persister = { version = "0.0.117", path = "../lightning-persister" }
47+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname

lightning-background-processor/src/lib.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,11 @@ use core::task;
501501
/// could setup `process_events_async` like this:
502502
/// ```
503503
/// # use lightning::io;
504+
<<<<<<< HEAD
504505
/// # use std::sync::{Arc, Mutex};
506+
=======
507+
/// # use std::sync::{Arc, RwLock};
508+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
505509
/// # use std::sync::atomic::{AtomicBool, Ordering};
506510
/// # use lightning_background_processor::{process_events_async, GossipSync};
507511
/// # struct MyStore {}
@@ -528,11 +532,15 @@ use core::task;
528532
/// # type MyFilter = dyn lightning::chain::Filter + Send + Sync;
529533
/// # type MyLogger = dyn lightning::util::logger::Logger + Send + Sync;
530534
/// # type MyChainMonitor = lightning::chain::chainmonitor::ChainMonitor<lightning::sign::InMemorySigner, Arc<MyFilter>, Arc<MyBroadcaster>, Arc<MyFeeEstimator>, Arc<MyLogger>, Arc<MyStore>>;
535+
<<<<<<< HEAD
531536
/// # type MyPeerManager = lightning::ln::peer_handler::SimpleArcPeerManager<MySocketDescriptor, MyChainMonitor, MyBroadcaster, MyFeeEstimator, MyUtxoLookup, MyLogger>;
537+
=======
538+
/// # type MyPeerManager = lightning::ln::peer_handler::SimpleArcPeerManager<MySocketDescriptor, MyChainMonitor, MyBroadcaster, MyFeeEstimator, Arc<MyUtxoLookup>, MyLogger>;
539+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
532540
/// # type MyNetworkGraph = lightning::routing::gossip::NetworkGraph<Arc<MyLogger>>;
533541
/// # type MyGossipSync = lightning::routing::gossip::P2PGossipSync<Arc<MyNetworkGraph>, Arc<MyUtxoLookup>, Arc<MyLogger>>;
534542
/// # type MyChannelManager = lightning::ln::channelmanager::SimpleArcChannelManager<MyChainMonitor, MyBroadcaster, MyFeeEstimator, MyLogger>;
535-
/// # type MyScorer = Mutex<lightning::routing::scoring::ProbabilisticScorer<Arc<MyNetworkGraph>, Arc<MyLogger>>>;
543+
/// # type MyScorer = RwLock<lightning::routing::scoring::ProbabilisticScorer<Arc<MyNetworkGraph>, Arc<MyLogger>>>;
536544
///
537545
/// # async fn setup_background_processing(my_persister: Arc<MyStore>, my_event_handler: Arc<MyEventHandler>, my_chain_monitor: Arc<MyChainMonitor>, my_channel_manager: Arc<MyChannelManager>, my_gossip_sync: Arc<MyGossipSync>, my_logger: Arc<MyLogger>, my_scorer: Arc<MyScorer>, my_peer_manager: Arc<MyPeerManager>) {
538546
/// let background_persister = Arc::clone(&my_persister);
@@ -1181,7 +1189,7 @@ mod tests {
11811189
let network_graph = Arc::new(NetworkGraph::new(network, logger.clone()));
11821190
let scorer = Arc::new(Mutex::new(TestScorer::new()));
11831191
let seed = [i as u8; 32];
1184-
let router = Arc::new(DefaultRouter::new(network_graph.clone(), logger.clone(), seed, scorer.clone(), ()));
1192+
let router = Arc::new(DefaultRouter::new(network_graph.clone(), logger.clone(), seed, scorer.clone(), Default::default()));
11851193
let chain_source = Arc::new(test_utils::TestChainSource::new(Network::Bitcoin));
11861194
let kv_store = Arc::new(FilesystemStore::new(format!("{}_persister_{}", &persist_dir, i).into()));
11871195
let now = Duration::from_secs(genesis_block.header.time as u64);

lightning-block-sync/Cargo.toml

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[package]
22
name = "lightning-block-sync"
3+
<<<<<<< HEAD
34
version = "0.0.117-rc1"
5+
=======
6+
version = "0.0.117"
7+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
48
authors = ["Jeffrey Czyz", "Matt Corallo"]
59
license = "MIT OR Apache-2.0"
610
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -19,11 +23,19 @@ rpc-client = [ "serde_json", "chunked_transfer" ]
1923

2024
[dependencies]
2125
bitcoin = "0.29.0"
26+
<<<<<<< HEAD
2227
lightning = { version = "0.0.117-rc1", path = "../lightning" }
28+
=======
29+
lightning = { version = "0.0.117", path = "../lightning" }
30+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
2331
tokio = { version = "1.0", features = [ "io-util", "net", "time" ], optional = true }
2432
serde_json = { version = "1.0", optional = true }
2533
chunked_transfer = { version = "1.4", optional = true }
2634

2735
[dev-dependencies]
36+
<<<<<<< HEAD
2837
lightning = { version = "0.0.117-rc1", path = "../lightning", features = ["_test_utils"] }
38+
=======
39+
lightning = { version = "0.0.117", path = "../lightning", features = ["_test_utils"] }
40+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
2941
tokio = { version = "1.14", features = [ "macros", "rt" ] }

lightning-custom-message/Cargo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[package]
22
name = "lightning-custom-message"
3+
<<<<<<< HEAD
34
version = "0.0.117-rc1"
5+
=======
6+
version = "0.0.117"
7+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
48
authors = ["Jeffrey Czyz"]
59
license = "MIT OR Apache-2.0"
610
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -15,4 +19,8 @@ rustdoc-args = ["--cfg", "docsrs"]
1519

1620
[dependencies]
1721
bitcoin = "0.29.0"
22+
<<<<<<< HEAD
1823
lightning = { version = "0.0.117-rc1", path = "../lightning" }
24+
=======
25+
lightning = { version = "0.0.117", path = "../lightning" }
26+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname

lightning-invoice/Cargo.toml

+12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
[package]
22
name = "lightning-invoice"
33
description = "Data structures to parse and serialize BOLT11 lightning invoices"
4+
<<<<<<< HEAD
45
version = "0.25.0-rc1"
6+
=======
7+
version = "0.25.0"
8+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
59
authors = ["Sebastian Geisler <sgeisler@wh2.tu-dresden.de>"]
610
documentation = "https://docs.rs/lightning-invoice/"
711
license = "MIT OR Apache-2.0"
@@ -21,7 +25,11 @@ std = ["bitcoin_hashes/std", "num-traits/std", "lightning/std", "bech32/std"]
2125

2226
[dependencies]
2327
bech32 = { version = "0.9.0", default-features = false }
28+
<<<<<<< HEAD
2429
lightning = { version = "0.0.117-rc1", path = "../lightning", default-features = false }
30+
=======
31+
lightning = { version = "0.0.117", path = "../lightning", default-features = false }
32+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
2533
secp256k1 = { version = "0.24.0", default-features = false, features = ["recovery", "alloc"] }
2634
num-traits = { version = "0.2.8", default-features = false }
2735
bitcoin_hashes = { version = "0.11", default-features = false }
@@ -30,6 +38,10 @@ serde = { version = "1.0.118", optional = true }
3038
bitcoin = { version = "0.29.0", default-features = false }
3139

3240
[dev-dependencies]
41+
<<<<<<< HEAD
3342
lightning = { version = "0.0.117-rc1", path = "../lightning", default-features = false, features = ["_test_utils"] }
43+
=======
44+
lightning = { version = "0.0.117", path = "../lightning", default-features = false, features = ["_test_utils"] }
45+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
3446
hex = "0.4"
3547
serde_json = { version = "1"}

lightning-invoice/src/payment.rs

+5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99

1010
//! Convenient utilities for paying Lightning invoices.
1111
12+
<<<<<<< HEAD
1213
use crate::{Bolt11Invoice, Vec};
14+
=======
15+
use crate::Bolt11Invoice;
16+
use crate::prelude::*;
17+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
1318

1419
use bitcoin_hashes::Hash;
1520

lightning-net-tokio/Cargo.toml

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[package]
22
name = "lightning-net-tokio"
3+
<<<<<<< HEAD
34
version = "0.0.117-rc1"
5+
=======
6+
version = "0.0.117"
7+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
48
authors = ["Matt Corallo"]
59
license = "MIT OR Apache-2.0"
610
repository = "https://github.com/lightningdevkit/rust-lightning/"
@@ -16,9 +20,17 @@ rustdoc-args = ["--cfg", "docsrs"]
1620

1721
[dependencies]
1822
bitcoin = "0.29.0"
23+
<<<<<<< HEAD
1924
lightning = { version = "0.0.117-rc1", path = "../lightning" }
25+
=======
26+
lightning = { version = "0.0.117", path = "../lightning" }
27+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname
2028
tokio = { version = "1.0", features = [ "rt", "sync", "net", "time" ] }
2129

2230
[dev-dependencies]
2331
tokio = { version = "1.14", features = [ "macros", "rt", "rt-multi-thread", "sync", "net", "time" ] }
32+
<<<<<<< HEAD
2433
lightning = { version = "0.0.117-rc1", path = "../lightning", features = ["_test_utils"] }
34+
=======
35+
lightning = { version = "0.0.117", path = "../lightning", features = ["_test_utils"] }
36+
>>>>>>> origin/impl-ToSocketAddrs-for-Hostname

0 commit comments

Comments
 (0)