Clarify the contexts in which persist_new_channel may be called
[rust-lightning] / CHANGELOG.md
1 # 0.0.101 - 2021-09-23
2
3 ## API Updates
4  * Custom message types are now supported directly in the `PeerManager`,
5    allowing you to send and receive messages of any type that is not natively
6    understood by LDK. This requires a new type bound on `PeerManager`, a
7    `CustomMessageHandler`. `IgnoringMessageHandler` provides a simple default
8    for this new bound for ignoring unknown messages (#1031, #1074).
9  * Route graph updates as a result of failed payments are no longer provided as
10    `MessageSendEvent::PaymentFailureNetworkUpdate` but instead included in a
11    new field in the `Event::PaymentFailed` events. Generally, this means route
12    graph updates are no longer handled as a part of the `PeerManager` but
13    instead through the new `EventHandler` implementation for
14    `NetGraphMsgHandler`. To make this easy, a new parameter to
15    `lightning-background-processor::BackgroundProcessor::start` is added, which
16    contains an `Option`al `NetGraphmsgHandler`. If provided as `Some`, relevant
17    events will be processed by the `NetGraphMsgHandler` prior to normal event
18    handling (#1043).
19  * `NetworkGraph` is now, itself, thread-safe. Accordingly, most functions now
20    take `&self` instead of `&mut self` and the graph data can be accessed
21    through `NetworkGraph.read_only` (#1043).
22  * The balances available on-chain to claim after a channel has been closed are
23    now exposed via `ChannelMonitor::get_claimable_balances` and
24    `ChainMonitor::get_claimable_balances`. The second can be used to get
25    information about all closed channels which still have on-chain balances
26    associated with them. See enum variants of `ln::channelmonitor::Balance` and
27    method documentation for the above methods for more information on the types
28    of balances exposed (#1034).
29  * When one HTLC of a multi-path payment fails, the new field `all_paths_failed`
30    in `Event::PaymentFailed` is set to `false`. This implies that the payment
31    has not failed, but only one part. Payment resolution is only indicated by an
32    `Event::PaymentSent` event or an `Event::PaymentFailed` with
33    `all_paths_failed` set to `true`, which is also set for the last remaining
34    part of a multi-path payment (#1053).
35  * To better capture the context described above, `Event::PaymentFailed` has
36    been renamed to `Event::PaymentPathFailed` (#1084).
37  * A new event, `ChannelClosed`, is provided by `ChannelManager` when a channel
38    is closed, including a reason and error message (if relevant, #997).
39  * `lightning-invoice` now considers invoices with sub-millisatoshi precision
40    to be invalid, and requires millisatoshi values during construction (thus
41    you must call `amount_milli_satoshis` instead of `amount_pico_btc`, #1057).
42  * The `BaseSign` interface now includes two new hooks which provide additional
43    information about commitment transaction signatures and revocation secrets
44    provided by our counterparty, allowing additional verification (#1039).
45  * The `BaseSign` interface now includes additional information for cooperative
46    close transactions, making it easier for a signer to verify requests (#1064).
47  * `Route` has two additional helper methods to get fees and amounts (#1063).
48  * `Txid` and `Transaction` objects can now be deserialized from responses when
49    using the HTTP client in the `lightning-block-sync` crate (#1037, #1061).
50
51 ## Bug Fixes
52  * Fix a panic when reading a lightning invoice with a non-recoverable
53    signature. Further, restrict lightning invoice parsing to require payment
54    secrets and better handle a few edge cases as required by BOLT 11 (#1057).
55  * Fix a panic when receiving multiple messages (such as HTLC fulfill messages)
56    after a call to `chain::Watch::update_channel` returned
57    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` with no
58    `ChannelManager::channel_monitor_updated` call in between (#1066).
59  * For multi-path payments, `Event::PaymentSent` is no longer generated
60    multiple times, once for each independent part (#1053).
61  * Multi-hop route hints in invoices are now considered in the default router
62    provided via `get_route` (#1040).
63  * The time peers have to respond to pings has been increased when building
64    with debug assertions enabled. This avoids peer disconnections on slow hosts
65    when running in debug mode (#1051).
66  * The timeout for the first byte of a response for requests from the
67    `lightning-block-sync` crate has been increased to 300 seconds to better
68    handle the long hangs in Bitcoin Core when it syncs to disk (#1090).
69
70 ## Serialization Compatibility
71  * Due to a bug in 0.0.100, `Event`s written by 0.0.101 which are of a type not
72    understood by 0.0.100 may lead to `Err(DecodeError::InvalidValue)` or corrupt
73    deserialized objects in 0.100. Such `Event`s will lead to an
74    `Err(DecodeError::InvalidValue)` in versions prior to 0.0.100. The only such
75    new event written by 0.0.101 is `Event::ChannelClosed` (#1087).
76  * Payments that were initiated in versions prior to 0.0.101 may still
77    generate duplicate `PaymentSent` `Event`s or may have spurious values for
78    `Event::PaymentPathFailed::all_paths_failed` (#1053).
79  * The return values of `ChannelMonitor::get_claimable_balances` (and, thus,
80    `ChainMonitor::get_claimable_balances`) may be spurious for channels where
81    the spend of the funding transaction appeared on chain while running a
82    version prior to 0.0.101. `Balance` information should only be relied upon
83    for channels that were closed while running 0.0.101+ (#1034).
84  * Payments failed while running versions prior to 0.0.101 will never have a
85    `Some` for the `network_update` field (#1043).
86
87 In total, this release features 67 files changed, 4980 insertions, 1888
88 deletions in 89 commits from 12 authors, in alphabetical order:
89  * Antoine Riard
90  * Devrandom
91  * Galder ZamarrenĖƒo
92  * Giles Cope
93  * Jeffrey Czyz
94  * Joseph Goulden
95  * Matt Corallo
96  * Sergi Delgado Segura
97  * Tibo-lg
98  * Valentine Wallace
99  * abhik-99
100  * vss96
101
102
103 # 0.0.100 - 2021-08-17
104
105 ## API Updates
106  * The `lightning` crate can now be built in no_std mode, making it easy to
107    target embedded hardware for rust users. Note that mutexes are replaced with
108    no-ops for such builds (#1008, #1028).
109  * LDK now supports sending and receiving "keysend" payments. This includes
110    modifications to `lightning::util::events::Event::PaymentReceived` to
111    indicate the type of payment (#967).
112  * A new variant, `lightning::util::events::Event::PaymentForwarded` has been
113    added which indicates a forwarded payment has been successfully claimed and
114    we've received a forwarding fee (#1004).
115  * `lightning::chain::keysinterface::KeysInterface::get_shutdown_pubkey` has
116    been renamed to `get_shutdown_scriptpubkey`, returns a script, and is now
117    called on channel open only if
118    `lightning::util::config::ChannelConfig::commit_upfront_shutdown_pubkey` is
119    set (#1019).
120  * Closing-signed negotiation is now more configurable, with an explicit
121    `lightning::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis`
122    field allowing you to select the maximum amount you are willing to pay to
123    avoid a force-closure. Further, we are now less restrictive on the fee
124    placed on the closing transaction when we are not the party paying it. To
125    control the feerate paid on a channel at close-time, use
126    `ChannelManager::close_channel_with_target_feerate` instead of
127    `close_channel` (#1011).
128  * `lightning_background_processor::BackgroundProcessor` now stops the
129    background thread when dropped (#1007). It is marked `#[must_use]` so that
130    Rust users will receive a compile-time warning when it is immediately
131    dropped after construction (#1029).
132  * Total potential funds burn on force-close due to dust outputs is now limited
133    to `lightning::util::config::ChannelConfig::max_dust_htlc_exposure_msat` per
134    channel (#1009).
135  * The interval on which
136    `lightning::ln::peer_handler::PeerManager::timer_tick_occurred` should be
137    called has been reduced to once every five seconds (#1035) and
138    `lightning::ln::channelmanager::ChannelManager::timer_tick_occurred` should
139    now be called on startup in addition to once per minute (#985).
140  * The rust-bitcoin and bech32 dependencies have been updated to their
141    respective latest versions (0.27 and 0.8, #1012).
142
143 ## Bug Fixes
144  * Fix panic when reading invoices generated by some versions of c-lightning
145    (#1002 and #1003).
146  * Fix panic when attempting to validate a signed message of incorrect length
147    (#1010).
148  * Do not ignore the route hints in invoices when the invoice is over 250k
149    sats (#986).
150  * Fees are automatically updated on outbound channels to ensure commitment
151    transactions are always broadcastable (#985).
152  * Fixes a rare case where a `lightning::util::events::Event::SpendableOutputs`
153    event is not generated after a counterparty commitment transaction is
154    confirmed in a reorg when a conflicting local commitment transaction is
155    removed in the same reorg (#1022).
156  * Fixes a remotely-triggerable force-closure of an origin channel after an
157    HTLC was forwarded over a next-hop channel and the next-hop channel was
158    force-closed by our counterparty (#1025).
159  * Fixes a rare force-closure case when sending a payment as a channel fundee
160    when overdrawing our remaining balance. Instead the send will fail (#998).
161  * Fixes a rare force-closure case when a payment was claimed prior to a
162    peer disconnection or restart, and later failed (#977).
163
164 ## Serialization Compatibility
165  * Pending inbound keysend payments which have neither been failed nor claimed
166    when serialized will result in a `ChannelManager` which is not readable on
167    pre-0.0.100 clients (#967).
168  * Because
169    `lightning::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey`
170    has been updated to return a script instead of only a `PublicKey`,
171    `ChannelManager`s constructed with custom `KeysInterface` implementations on
172    0.0.100 and later versions will not be readable on previous versions.
173    `ChannelManager`s created with 0.0.99 and prior versions will remain readable
174    even after the a serialization roundtrip on 0.0.100, as long as no new
175    channels are opened. Further, users using a
176    `lightning::chain::keysinterface::KeysManager` as their `KeysInterface` will
177    have `ChannelManager`s which are readable on prior versions as well (#1019).
178  * `ChannelMonitorUpdate`s created by 0.0.100 and later for channels when
179    `lightning::util::config::ChannelConfig::commit_upfront_shutdown_pubkey` is
180    not set may not be readable by versions prior to 0.0.100 (#1019).
181  * HTLCs which were in the process of being claimed on-chain when a pre-0.0.100
182    `ChannelMonitor` was serialized may generate `PaymentForwarded` events with
183    spurious `fee_earned_msat` values. This only applies to payments which were
184    unresolved at the time of the upgrade (#1004).
185  * 0.0.100 clients with pending `Event::PaymentForwarded` events at
186    serialization-time will generate serialized `ChannelManager` objects which
187    0.0.99 and earlier clients cannot read. The likelihood of this can be reduced
188    by ensuring you process all pending events immediately before serialization
189    (as is done by the `lightning-background-processor` crate, #1004).
190
191
192 In total, this release features 59 files changed, 5861 insertions, and 2082
193 deletions in 95 commits from 6 authors.
194
195
196 # 0.0.99 - 2021-07-09
197
198 ## API Updates
199
200  * `lightning_block_sync::poll::Validate` is now public, allowing you to
201    implement the `lightning_block_sync::poll::Poll` trait without
202    `lightning_block_sync::poll::ChainPoller` (#956).
203  * `lightning::ln::peer_handler::PeerManager` no longer requires that no calls
204    are made to referencing the same `SocketDescriptor` after
205    `disconnect_socket` returns. This makes the API significantly less
206    deadlock-prone and simplifies `SocketDescriptor` implementations
207    significantly. The relevant changes have been made to `lightning_net_tokio`
208    and `PeerManager` documentation has been substantially rewritten (#957).
209  * `lightning::util::message_signing`'s `sign` and `verify` methods now take
210    secret and public keys by reference instead of value (#974).
211  * Substantially more information is now exposed about channels in
212    `ChannelDetails`. See documentation for more info (#984 and #988).
213  * The latest best block seen is now exposed in
214    `ChannelManager::current_best_block` and
215    `ChannelMonitor::current_best_block` (#984).
216  * Feerates charged when forwarding payments over channels is now set in
217    `ChannelConfig::fee_base_msat` when the channel is opened. For existing
218    channels, the value is set to the value provided in
219    `ChannelManagerReadArgs::default_config::channel_options` the first time the
220    `ChannelManager` is loaded in 0.0.99 (#975).
221  * We now reject HTLCs which are received to be forwarded over private channels
222    unless `UserConfig::accept_forwards_to_priv_channels` is set. Note that
223    `UserConfig` is never serialized and must be provided via
224    `ChannelManagerReadArgs::default_config` at each start (#975).
225
226 ## Bug Fixes
227
228  * We now forward gossip messages to peers instead of only relaying
229    locally-generated gossip or sending gossip messages during initial sync
230    (#948).
231  * Correctly send `channel_update` messages to direct peers on private channels
232    (#949). Without this, a private node connected to an LDK node over a private
233    channel cannot receive funds as it does not know which fees the LDK node
234    will charge.
235  * `lightning::ln::channelmanager::ChannelManager` no longer expects to be
236    persisted spuriously after we receive a `channel_update` message about any
237    channel in the routing gossip (#972).
238  * Asynchronous `ChannelMonitor` updates (using the
239    `ChannelMonitorUpdateErr::TemporaryFailure` return variant) no longer cause
240    spurious HTLC forwarding failures (#954).
241  * Transaction provided via `ChannelMonitor::transactions_confirmed`
242    after `ChannelMonitor::best_block_updated` was called for a much later
243    block now trigger all relevant actions as of the later block. Previously
244    some transaction broadcasts or other responses required an additional
245    block be provided via `ChannelMonitor::best_block_updated` (#970).
246  * We no longer panic in rare cases when an invoice contained last-hop route
247    hints which were unusable (#958).
248
249 ## Node Compatibility
250
251  * We now accept spurious `funding_locked` messages sent prior to
252    `channel_reestablish` messages after reconnect. This is a
253    [known, long-standing bug in lnd](https://github.com/lightningnetwork/lnd/issues/4006)
254    (#966).
255  * We now set the `first_blocknum` and `number_of_blocks` fields in
256    `reply_channel_range` messages to values which c-lightning versions prior to
257    0.10 accepted. This avoids spurious force-closes from such nodes (#961).
258
259 ## Serialization Compatibility
260
261  * Due to a bug discovered in 0.0.98, if a `ChannelManager` is serialized on
262    version 0.0.98 while an `Event::PaymentSent` is pending processing, the
263    `ChannelManager` will fail to deserialize both on version 0.0.98 and later
264    versions. If you have such a `ChannelManager` available, a simple patch will
265    allow it to deserialize. Please file an issue if you need assistance (#973).
266
267 # 0.0.98 - 2021-06-11
268
269 0.0.98 should be considered a release candidate to the first alpha release of
270 Rust-Lightning and the broader LDK. It represents several years of work
271 designing and fine-tuning a flexible API for integrating lightning into any
272 application. LDK should make it easy to build a lightning node or client which
273 meets specific requirements that other lightning node software cannot. As
274 lightning continues to evolve, and new use-cases for lightning develop, the API
275 of LDK will continue to change and expand. However, starting with version 0.1,
276 objects serialized with prior versions will be readable with the latest LDK.
277 While Rust-Lightning is approaching the 0.1 milestone, language bindings
278 components of LDK available at https://github.com/lightningdevkit are still of
279 varying quality. Some are also approaching an 0.1 release, while others are
280 still much more experimental. Please note that, at 0.0.98, using Rust-Lightning
281 on mainnet is *strongly* discouraged.