Skip to content

Commit 74960ee

Browse files
authored
Merge branch 'lightningdevkit:main' into issue438
2 parents 08794b5 + 716539e commit 74960ee

File tree

30 files changed

+689
-391
lines changed

30 files changed

+689
-391
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,27 @@ jobs:
275275
- name: For each commit, run cargo check (including in fuzz)
276276
run: ci/check-each-commit.sh upstream/main
277277

278+
check_release:
279+
runs-on: ubuntu-latest
280+
env:
281+
TOOLCHAIN: stable
282+
steps:
283+
- name: Checkout source code
284+
uses: actions/checkout@v3
285+
with:
286+
fetch-depth: 0
287+
- name: Install Rust ${{ env.TOOLCHAIN }} toolchain
288+
uses: actions-rs/toolchain@v1
289+
with:
290+
toolchain: ${{ env.TOOLCHAIN }}
291+
override: true
292+
profile: minimal
293+
- name: Run cargo check for release build.
294+
run: |
295+
cargo check --release
296+
cargo check --no-default-features --features=no-std --release
297+
cargo doc --release
298+
278299
fuzz:
279300
runs-on: ubuntu-latest
280301
env:

CHANGELOG.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,163 @@
1+
# 0.0.108 - 2022-06-10
2+
3+
## Bug Fixes
4+
* Fixed `lightning-background-processor` build in release mode.
5+
6+
In total, this release features 9 files changed, 120 insertions, 74
7+
deletions in 5 commits from 4 authors, in alphabetical order:
8+
* Elias Rohrer
9+
* Matt Corallo
10+
* Max Fang
11+
* Viktor Tigerström
12+
13+
# 0.0.107 - 2022-06-08
14+
15+
## API Updates
16+
* Channels larger than 16777215 sats (Wumbo!) are now supported and can be
17+
enabled for inbound channels using
18+
`ChannelHandshakeLimits::max_funding_satoshis` (#1425).
19+
* Support for feature `option_zeroconf`, allowing immediate forwarding of
20+
payments after channel opening. This is configured for outbound channels
21+
using `ChannelHandshakeLimits::trust_own_funding_0conf` whereas
22+
`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf` has to be
23+
used for accepting inbound channels (#1401, #1505).
24+
* `ChannelManager::claim_funds` no longer returns a `bool` to indicate success.
25+
Instead, an `Event::PaymentClaimed` is generated if the claim was successful.
26+
Likewise, `ChannelManager::fail_htlc_backwards` no longer has a return value
27+
(#1434).
28+
* `lightning-rapid-gossip-sync` is a new crate for syncing gossip data from a
29+
server, primarily aimed at mobile devices (#1155).
30+
* `RapidGossipSync` can be passed to `BackgroundProcessor` in order to persist
31+
the `NetworkGraph` and handle `NetworkUpdate`s during event handling (#1433,
32+
#1517).
33+
* `NetGraphMsgHandler` has been renamed to `P2PGossipSync`, the `network_graph`
34+
module has been renamed to `gossip`, and `NetworkUpdate::ChannelClosed` has
35+
been renamed `NetworkUpdate::ChannelFailure` (#1159).
36+
* Added a `filtered_block_connected` method to `chain::Listen` and a default
37+
implementation of `block_connected` for those fetching filtered instead of
38+
full blocks (#1453).
39+
* The `lightning-block-sync` crate's `BlockSource` trait methods now take
40+
`&self` instead of `&mut self` (#1307).
41+
* `inbound_payment` module is now public to allow for creating invoices without
42+
a `ChannelManager` (#1384).
43+
* `lightning-block-sync`'s `init` and `poll` modules support `&dyn BlockSource`
44+
which can be determined at runtime (#1423).
45+
* `lightning-invoice` crate's `utils` now accept an expiration time (#1422,
46+
#1474).
47+
* `Event::PaymentForwarded` includes `prev_channel_id` and `next_channel_id`
48+
(#1419, #1475).
49+
* `chain::Watch::release_pending_monitor_events`' return type now associates
50+
`MonitorEvent`s with funding `OutPoints` (#1475).
51+
* `lightning-background-processor` crate's `Persister` trait has been moved to
52+
`lightning` crate's `util::persist` module, which now has a general
53+
`KVStorePersister` trait. Blanket implementations of `Persister` and
54+
`chainmonitor::Persist` are given for types implementing `KVStorePersister`.
55+
` lightning-persister`'s `FilesystemPersister` implements `KVStorePersister`
56+
(#1417).
57+
* `ChannelDetails` and `ChannelCounterparty` include fields for HTLC minimum
58+
and maximum values (#1378).
59+
* Added a `max_inbound_htlc_value_in_flight_percent_of_channel` field to
60+
`ChannelHandshakeConfig`, capping the total value of outstanding inbound
61+
HTLCs for a channel (#1444).
62+
* `ProbabilisticScorer` is parameterized by a `Logger`, which it uses to log
63+
channel liquidity updates or lack thereof (#1405).
64+
* `ChannelDetails` has an `outbound_htlc_limit_msat` field, which should be
65+
used in routing instead of `outbound_capacity_msat` (#1435).
66+
* `ProbabilisticScorer`'s channel liquidities can be logged via
67+
`debug_log_liquidity_stats` (#1460).
68+
* `BackgroundProcessor` now takes an optional `WriteableScore` which it will
69+
persist using the `Persister` trait's new `persist_scorer` method (#1416).
70+
* Upgraded to `bitcoin` crate version 0.28.1 (#1389).
71+
* `ShutdownScript::new_witness_program` now takes a `WitnessVersion` instead of
72+
a `NonZeroU8` (#1389).
73+
* Channels will no longer be automatically force closed when the counterparty
74+
is disconnected due to incompatibility (#1429).
75+
* `ChannelManager` methods for funding, accepting, and closing channels now
76+
take a `counterparty_node_id` parameter, which has also been added as a field
77+
to `Event::FundingGenerationReady` (#1479, #1485).
78+
* `InvoicePayer::new` now takes a `Retry` enum (replacing the `RetryAttempts`
79+
struct), which supports both attempt- and timeout-based retrying (#1418).
80+
* `Score::channel_penalty_msat` takes a `ChannelUsage` struct, which contains
81+
the capacity as an `EffectiveCapacity` enum and any potential in-flight HTLC
82+
value, rather than a single `u64`. Used by `ProbabilisticScorer` for more
83+
accurate penalties (#1456).
84+
* `build_route_from_hops` is a new function useful for constructing a `Route`
85+
given a specific list of public keys (#1491).
86+
* `FundingLocked` message has been renamed `ChannelReady`, and related
87+
identifiers have been renamed accordingly (#1506).
88+
* `core2::io` or `std::io` (depending on feature flags `no-std` or `std`) is
89+
exported as a `lightning::io` module (#1504).
90+
* The deprecated `Scorer` has been removed in favor or `ProbabilisticScorer`
91+
(#1512).
92+
93+
## Performance Improvements
94+
* `lightning-persister` crate's `FilesystemPersister` is faster by 15x (#1404).
95+
* Log gossip query messages at `GOSSIP` instead of `TRACE` to avoid
96+
overwhelming default logging (#1421).
97+
* `PeerManager` supports processing messages from different peers in parallel,
98+
and this is taken advantage of in gossip processing (#1023).
99+
* Greatly reduced per-channel and per-node memory usage due to upgrade of
100+
`secp256k1` crate to 0.22.1 and `bitcoin` crate to 0.28.1
101+
* Reduced per-peer memory usage in `PeerManager` (#1472).
102+
103+
## Spec Compliance
104+
* `find_route` now assumes variable-length onions by default for nodes where
105+
support for the feature is unknown (#1414).
106+
* A `warn` message is now sent when receiving a `channel_reestablish` with an
107+
old commitment transaction number rather than immediately force-closing the
108+
channel (#1430).
109+
* When a `channel_update` message is included in an onion error's `failuremsg`,
110+
its message type is now encoded. Reading such messages is also supported
111+
(#1465).
112+
113+
## Bug Fixes
114+
* Fixed a bug where crashing while persisting a `ChannelMonitorUpdate` for a
115+
part of a multi-path payment could cause loss of funds due to a partial
116+
payment claim on restart (#1434).
117+
* `BackgroundProcessor` has been fixed to improve serialization reliability on
118+
slow systems which can avoid force-closes (#1436).
119+
* `gossip_timestamp_filter` filters are now honored when sending gossip to
120+
peers (#1452).
121+
* During a reorg, only force-close a channel if its funding transaction is
122+
unconfirmed rather than as it loses confirmations (#1461).
123+
* Fixed a rare panic in `lightning-net-tokio` when fetching a peer's socket
124+
address after the connection has been closed caused by a race condition
125+
(#1449).
126+
* `find_route` will no longer return routes that would cause onion construction
127+
to fail in some cases (#1476).
128+
* `ProbabilisticScorer` uses more precision when approximating `log10` (#1406).
129+
130+
## Serialization Compatibility
131+
* All above new events/fields are ignored by prior clients. All above new
132+
events/fields are not present when reading objects serialized by prior
133+
versions of the library.
134+
* `ChannelManager` serialization is no longer compatible with versions prior to
135+
0.0.99 (#1401).
136+
* Channels with `option_zeroconf` feature enabled (not required for 0-conf
137+
channel use) will be unreadable by versions prior to 0.0.107 (#1401, #1505).
138+
139+
In total, this release features 96 files changed, 9304 insertions, 4503
140+
deletions in 153 commits from 18 authors, in alphabetical order:
141+
* Arik Sosman
142+
* Devrandom
143+
* Duncan Dean
144+
* Elias Rohrer
145+
* Jeffrey Czyz
146+
* John Cantrell
147+
* John Corser
148+
* Jurvis Tan
149+
* Justin Moon
150+
* KaFai Choi
151+
* Mateusz Faltyn
152+
* Matt Corallo
153+
* Valentine Wallace
154+
* Viktor Tigerström
155+
* Vincenzo Palazzo
156+
* atalw
157+
* dependabot[bot]
158+
* shamardy
159+
160+
1161
# 0.0.106 - 2022-04-03
2162

3163
## API Updates

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Crates
5050
this is a simple alternative to implementing the required network stack, especially for those already using Tokio.
5151
6. [lightning-persister](./lightning-persister)
5252
Utilities to manage Rust-Lightning channel data persistence and retrieval.
53+
7. [lightning-rapid-gossip-sync](./lightning-rapid-gossip-sync)
54+
Client for rapid gossip graph syncing, aimed primarily at mobile clients.
5355

5456
About
5557
-----------

fuzz/src/full_stack.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ type ChannelMan = ChannelManager<
163163
EnforcingSigner,
164164
Arc<chainmonitor::ChainMonitor<EnforcingSigner, Arc<dyn chain::Filter>, Arc<TestBroadcaster>, Arc<FuzzEstimator>, Arc<dyn Logger>, Arc<TestPersister>>>,
165165
Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>, Arc<dyn Logger>>;
166-
type PeerMan<'a> = PeerManager<Peer<'a>, Arc<ChannelMan>, Arc<P2PGossipSync<Arc<NetworkGraph>, Arc<dyn chain::Access>, Arc<dyn Logger>>>, Arc<dyn Logger>, IgnoringMessageHandler>;
166+
type PeerMan<'a> = PeerManager<Peer<'a>, Arc<ChannelMan>, Arc<P2PGossipSync<Arc<NetworkGraph<Arc<dyn Logger>>>, Arc<dyn chain::Access>, Arc<dyn Logger>>>, Arc<dyn Logger>, IgnoringMessageHandler>;
167167

168168
struct MoneyLossDetector<'a> {
169169
manager: Arc<ChannelMan>,
@@ -395,7 +395,7 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
395395
// it's easier to just increment the counter here so the keys don't change.
396396
keys_manager.counter.fetch_sub(1, Ordering::AcqRel);
397397
let our_id = PublicKey::from_secret_key(&Secp256k1::signing_only(), &keys_manager.get_node_secret(Recipient::Node).unwrap());
398-
let network_graph = Arc::new(NetworkGraph::new(genesis_block(network).block_hash()));
398+
let network_graph = Arc::new(NetworkGraph::new(genesis_block(network).block_hash(), Arc::clone(&logger)));
399399
let gossip_sync = Arc::new(P2PGossipSync::new(Arc::clone(&network_graph), None, Arc::clone(&logger)));
400400
let scorer = FixedPenaltyScorer::with_penalty(0);
401401

@@ -460,7 +460,7 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
460460
final_cltv_expiry_delta: 42,
461461
};
462462
let random_seed_bytes: [u8; 32] = keys_manager.get_secure_random_bytes();
463-
let route = match find_route(&our_id, &params, &network_graph, None, Arc::clone(&logger), &scorer, &random_seed_bytes) {
463+
let route = match find_route(&our_id, &params, &network_graph.read_only(), None, Arc::clone(&logger), &scorer, &random_seed_bytes) {
464464
Ok(route) => route,
465465
Err(_) => return,
466466
};
@@ -484,7 +484,7 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
484484
final_cltv_expiry_delta: 42,
485485
};
486486
let random_seed_bytes: [u8; 32] = keys_manager.get_secure_random_bytes();
487-
let mut route = match find_route(&our_id, &params, &network_graph, None, Arc::clone(&logger), &scorer, &random_seed_bytes) {
487+
let mut route = match find_route(&our_id, &params, &network_graph.read_only(), None, Arc::clone(&logger), &scorer, &random_seed_bytes) {
488488
Ok(route) => route,
489489
Err(_) => return,
490490
};

fuzz/src/process_network_graph.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
// Imports that need to be added manually
2+
use lightning::util::logger::Logger;
23
use lightning_rapid_gossip_sync::RapidGossipSync;
4+
35
use utils::test_logger;
46

7+
use std::sync::Arc;
8+
59
/// Actual fuzz test, method signature and name are fixed
6-
fn do_test(data: &[u8]) {
10+
fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
711
let block_hash = bitcoin::BlockHash::default();
8-
let network_graph = lightning::routing::gossip::NetworkGraph::new(block_hash);
12+
let logger: Arc<dyn Logger> = Arc::new(test_logger::TestLogger::new("".to_owned(), out));
13+
let network_graph = lightning::routing::gossip::NetworkGraph::new(block_hash, logger);
914
let rapid_sync = RapidGossipSync::new(&network_graph);
1015
let _ = rapid_sync.update_network_graph(data);
1116
}
1217

1318
/// Method that needs to be added manually, {name}_test
14-
pub fn process_network_graph_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
15-
do_test(data);
19+
pub fn process_network_graph_test<Out: test_logger::Output>(data: &[u8], out: Out) {
20+
do_test(data, out);
1621
}
1722

1823
/// Method that needs to be added manually, {name}_run
1924
#[no_mangle]
2025
pub extern "C" fn process_network_graph_run(data: *const u8, datalen: usize) {
21-
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
26+
do_test(unsafe { std::slice::from_raw_parts(data, datalen) }, test_logger::DevNull {});
2227
}

fuzz/src/router.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
162162
let logger: Arc<dyn Logger> = Arc::new(test_logger::TestLogger::new("".to_owned(), out));
163163

164164
let our_pubkey = get_pubkey!();
165-
let net_graph = NetworkGraph::new(genesis_block(Network::Bitcoin).header.block_hash());
165+
let net_graph = NetworkGraph::new(genesis_block(Network::Bitcoin).header.block_hash(), Arc::clone(&logger));
166166

167167
let mut node_pks = HashSet::new();
168168
let mut scid = 42;
@@ -267,7 +267,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
267267
final_value_msat: slice_to_be64(get_slice!(8)),
268268
final_cltv_expiry_delta: slice_to_be32(get_slice!(4)),
269269
};
270-
let _ = find_route(&our_pubkey, &route_params, &net_graph,
270+
let _ = find_route(&our_pubkey, &route_params, &net_graph.read_only(),
271271
first_hops.map(|c| c.iter().collect::<Vec<_>>()).as_ref().map(|a| a.as_slice()),
272272
Arc::clone(&logger), &scorer, &random_seed_bytes);
273273
}

lightning-background-processor/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-background-processor"
3-
version = "0.0.106"
3+
version = "0.0.108"
44
authors = ["Valentine Wallace <vwallace@protonmail.com>"]
55
license = "MIT OR Apache-2.0"
66
repository = "http://github.com/lightningdevkit/rust-lightning"
@@ -15,10 +15,10 @@ rustdoc-args = ["--cfg", "docsrs"]
1515

1616
[dependencies]
1717
bitcoin = "0.28.1"
18-
lightning = { version = "0.0.106", path = "../lightning", features = ["std"] }
19-
lightning-rapid-gossip-sync = { version = "0.0.106", path = "../lightning-rapid-gossip-sync" }
18+
lightning = { version = "0.0.108", path = "../lightning", features = ["std"] }
19+
lightning-rapid-gossip-sync = { version = "0.0.108", path = "../lightning-rapid-gossip-sync" }
2020

2121
[dev-dependencies]
22-
lightning = { version = "0.0.106", path = "../lightning", features = ["_test_utils"] }
23-
lightning-invoice = { version = "0.14.0", path = "../lightning-invoice" }
24-
lightning-persister = { version = "0.0.106", path = "../lightning-persister" }
22+
lightning = { version = "0.0.108", path = "../lightning", features = ["_test_utils"] }
23+
lightning-invoice = { version = "0.16.0", path = "../lightning-invoice" }
24+
lightning-persister = { version = "0.0.108", path = "../lightning-persister" }

0 commit comments

Comments
 (0)