Skip to content

Commit e3bdfa0

Browse files
authored
Merge pull request #1153 from TheBlueMatt/2021-11-0.0.103
One final fix + cut 0.0.103
2 parents 55fc0a1 + 2b837bb commit e3bdfa0

File tree

8 files changed

+103
-23
lines changed

8 files changed

+103
-23
lines changed

CHANGELOG.md

+66
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,69 @@
1+
# 0.0.103 - 2021-11-02
2+
3+
## API Updates
4+
* This release is almost entirely focused on a new API in the
5+
`lightning-invoice` crate - the `InvoicePayer`. `InvoicePayer` is a
6+
struct which takes a reference to a `ChannelManager` and a `NetworkGraph`
7+
and retries payments as paths fail. It limits retries to a configurable
8+
number, but is not serialized to disk and may retry additional times across
9+
a serialization/load. In order to learn about failed payments, it must
10+
receive `Event`s directly from the `ChannelManager`, wrapping a
11+
user-provided `EventHandler` which it provides all unhandled events to
12+
(#1059).
13+
* `get_route` has been renamed `find_route` (#1059) and now takes a `Payee`
14+
struct in replacement of a number of its long list of arguments (#1134).
15+
`Payee` is further stored in the `Route` object returned and provided in the
16+
`RouteParameters` contained in `Event::PaymentPathFailed` (#1059).
17+
* `ChannelMonitor`s must now be persisted after calls which provide new block
18+
data, prior to `MonitorEvent`s being passed back to `ChannelManager` for
19+
processing. If you are using a `ChainMonitor` this is handled for you.
20+
The `Persist` API has been updated to `Option`ally take the
21+
`ChannelMonitorUpdate` as persistence events that result from chain data no
22+
longer have a corresponding update (#1108).
23+
* `routing::Score` now has a `payment_path_failed` method which it can use to
24+
learn which channels often fail payments. It is automatically called by
25+
`InvoicePayer` for failed payment paths (#1144).
26+
* The default `Scorer` implementation is now a type alias to a type generic
27+
across different clocks and supports serialization to persist scoring data
28+
across restarts (#1146).
29+
* `Event::PaymentSent` now includes the full fee which was spent across all
30+
payment paths which were fulfilled or pending when the payment was fulfilled
31+
(#1142).
32+
* `NetGraphMsgHandler` now takes a `Deref` to the `NetworkGraph`, allowing for
33+
shared references to the graph data to make serialization and references to
34+
the graph data in the `InvoicePayer`'s `Router` simpler (#1149).
35+
* `routing::Score::channel_penalty_msat` has been updated to provide the
36+
`NodeId` of both the source and destination nodes of a channel (#1133).
37+
38+
## Bug Fixes
39+
* Delay disconnecting peers if we receive messages from them even if it takes
40+
a while to receive a pong from them. Further, avoid sending too many gossip
41+
messages between pings to ensure we should always receive pongs in a timely
42+
manner. Together, these should significantly reduce instances of us failing
43+
to remain connected to a peer during initial gossip sync (#1137).
44+
* If a payment is sent, creating an outbound HTLC and sending it to our
45+
counterparty (implying the `ChannelMonitor` was persisted on disk), but the
46+
`ChannelManager` was not persisted prior to shutdown/crash, no
47+
`Event::PaymentPathFailed` event will be generated if the HTLC is eventually
48+
failed on chain (#1104).
49+
50+
## Serialization Compatibility
51+
* All above new Events/fields are ignored by prior clients. All above new
52+
Events/fields are not present when reading objects serialized by prior
53+
versions of the library.
54+
* Payments for which a `Route` was generated using a previous version or for
55+
which the payment was originally sent by a previous version of the library
56+
will not be retried by an `InvoicePayer`.
57+
58+
This release was singularly focused and some contributions by third parties
59+
were delayed.
60+
In total, this release features 38 files changed, 4414 insertions, and 969
61+
deletions in 71 commits from 2 authors, in alphabetical order:
62+
63+
* Jeffrey Czyz
64+
* Matt Corallo
65+
66+
167
# 0.0.102 - 2021-10-18
268

369
## API Updates
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-background-processor"
3-
version = "0.0.102"
3+
version = "0.0.103"
44
authors = ["Valentine Wallace <[email protected]>"]
55
license = "MIT OR Apache-2.0"
66
repository = "http://github.com/rust-bitcoin/rust-lightning"
@@ -11,9 +11,9 @@ edition = "2018"
1111

1212
[dependencies]
1313
bitcoin = "0.27"
14-
lightning = { version = "0.0.102", path = "../lightning", features = ["allow_wallclock_use"] }
15-
lightning-persister = { version = "0.0.102", path = "../lightning-persister" }
14+
lightning = { version = "0.0.103", path = "../lightning", features = ["allow_wallclock_use"] }
15+
lightning-persister = { version = "0.0.103", path = "../lightning-persister" }
1616

1717
[dev-dependencies]
18-
lightning = { version = "0.0.102", path = "../lightning", features = ["_test_utils"] }
19-
lightning-invoice = { version = "0.10.0", path = "../lightning-invoice" }
18+
lightning = { version = "0.0.103", path = "../lightning", features = ["_test_utils"] }
19+
lightning-invoice = { version = "0.11.0", path = "../lightning-invoice" }

lightning-block-sync/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-block-sync"
3-
version = "0.0.102"
3+
version = "0.0.103"
44
authors = ["Jeffrey Czyz", "Matt Corallo"]
55
license = "MIT OR Apache-2.0"
66
repository = "http://github.com/rust-bitcoin/rust-lightning"
@@ -15,7 +15,7 @@ rpc-client = [ "serde", "serde_json", "chunked_transfer" ]
1515

1616
[dependencies]
1717
bitcoin = "0.27"
18-
lightning = { version = "0.0.102", path = "../lightning" }
18+
lightning = { version = "0.0.103", path = "../lightning" }
1919
tokio = { version = "1.0", features = [ "io-util", "net", "time" ], optional = true }
2020
serde = { version = "1.0", features = ["derive"], optional = true }
2121
serde_json = { version = "1.0", optional = true }

lightning-invoice/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "lightning-invoice"
33
description = "Data structures to parse and serialize BOLT11 lightning invoices"
4-
version = "0.10.0"
4+
version = "0.11.0"
55
authors = ["Sebastian Geisler <[email protected]>"]
66
documentation = "https://docs.rs/lightning-invoice/"
77
license = "MIT OR Apache-2.0"
@@ -10,11 +10,11 @@ readme = "README.md"
1010

1111
[dependencies]
1212
bech32 = "0.8"
13-
lightning = { version = "0.0.102", path = "../lightning" }
13+
lightning = { version = "0.0.103", path = "../lightning" }
1414
secp256k1 = { version = "0.20", features = ["recovery"] }
1515
num-traits = "0.2.8"
1616
bitcoin_hashes = "0.10"
1717

1818
[dev-dependencies]
1919
hex = "0.3"
20-
lightning = { version = "0.0.102", path = "../lightning", features = ["_test_utils"] }
20+
lightning = { version = "0.0.103", path = "../lightning", features = ["_test_utils"] }

lightning-net-tokio/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-net-tokio"
3-
version = "0.0.102"
3+
version = "0.0.103"
44
authors = ["Matt Corallo"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/rust-bitcoin/rust-lightning/"
@@ -12,7 +12,7 @@ edition = "2018"
1212

1313
[dependencies]
1414
bitcoin = "0.27"
15-
lightning = { version = "0.0.102", path = "../lightning" }
15+
lightning = { version = "0.0.103", path = "../lightning" }
1616
tokio = { version = "1.0", features = [ "io-util", "macros", "rt", "sync", "net", "time" ] }
1717

1818
[dev-dependencies]

lightning-persister/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-persister"
3-
version = "0.0.102"
3+
version = "0.0.103"
44
authors = ["Valentine Wallace", "Matt Corallo"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/rust-bitcoin/rust-lightning/"
@@ -13,11 +13,11 @@ unstable = ["lightning/unstable"]
1313

1414
[dependencies]
1515
bitcoin = "0.27"
16-
lightning = { version = "0.0.102", path = "../lightning" }
16+
lightning = { version = "0.0.103", path = "../lightning" }
1717
libc = "0.2"
1818

1919
[target.'cfg(windows)'.dependencies]
2020
winapi = { version = "0.3", features = ["winbase"] }
2121

2222
[dev-dependencies]
23-
lightning = { version = "0.0.102", path = "../lightning", features = ["_test_utils"] }
23+
lightning = { version = "0.0.103", path = "../lightning", features = ["_test_utils"] }

lightning/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning"
3-
version = "0.0.102"
3+
version = "0.0.103"
44
authors = ["Matt Corallo"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/rust-bitcoin/rust-lightning/"

lightning/src/routing/scorer.rs

+21-7
Original file line numberDiff line numberDiff line change
@@ -275,34 +275,48 @@ impl<T: Time> Writeable for ScorerUsingTime<T> {
275275
#[inline]
276276
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
277277
self.params.write(w)?;
278-
self.channel_failures.write(w)
278+
self.channel_failures.write(w)?;
279+
write_tlv_fields!(w, {});
280+
Ok(())
279281
}
280282
}
281283

282284
impl<T: Time> Readable for ScorerUsingTime<T> {
283285
#[inline]
284286
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
285-
Ok(Self {
287+
let res = Ok(Self {
286288
params: Readable::read(r)?,
287289
channel_failures: Readable::read(r)?,
288-
})
290+
});
291+
read_tlv_fields!(r, {});
292+
res
289293
}
290294
}
291295

292296
impl<T: Time> Writeable for ChannelFailure<T> {
293297
#[inline]
294298
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
295-
self.undecayed_penalty_msat.write(w)?;
296-
(T::duration_since_epoch() - self.last_failed.elapsed()).write(w)
299+
let duration_since_epoch = T::duration_since_epoch() - self.last_failed.elapsed();
300+
write_tlv_fields!(w, {
301+
(0, self.undecayed_penalty_msat, required),
302+
(2, duration_since_epoch, required),
303+
});
304+
Ok(())
297305
}
298306
}
299307

300308
impl<T: Time> Readable for ChannelFailure<T> {
301309
#[inline]
302310
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
311+
let mut undecayed_penalty_msat = 0;
312+
let mut duration_since_epoch = Duration::from_secs(0);
313+
read_tlv_fields!(r, {
314+
(0, undecayed_penalty_msat, required),
315+
(2, duration_since_epoch, required),
316+
});
303317
Ok(Self {
304-
undecayed_penalty_msat: Readable::read(r)?,
305-
last_failed: T::now() - (T::duration_since_epoch() - Readable::read(r)?),
318+
undecayed_penalty_msat,
319+
last_failed: T::now() - (T::duration_since_epoch() - duration_since_epoch),
306320
})
307321
}
308322
}

0 commit comments

Comments
 (0)