]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
2 years agoUnset `Channel::is_usable` if mon update is blocking funding_locked
Matt Corallo [Thu, 18 Nov 2021 21:54:10 +0000 (21:54 +0000)]
Unset `Channel::is_usable` if mon update is blocking funding_locked

If we have not yet sent `funding_locked` only because of a pending
channel monitor update, we shouldn't consider a channel
`is_usable`. This has a number of downstream effects, including
not attempting to route payments through the channel, not sending
private `channel_update` messages to our counterparty, or sending
channel_announcement messages if our couterparty has already signed
for it.

We further gate generation of `node_announcement`s on `is_usable`,
preventing generation of those or `announcement_signatures` until
we've sent our `funding_locked`.

Finally, `during_funding_monitor_fail` is updated to test a case
where we see the funding transaction lock in but have a pending
monitor update failure, then receive `funding_locked` from our
counterparty and ensure we don't generate the above messages until
after the monitor update completes.

2 years agoDo not Send FundingLocked messages while disconnected
Matt Corallo [Mon, 15 Nov 2021 01:09:27 +0000 (01:09 +0000)]
Do not Send FundingLocked messages while disconnected

While its generally harmless to do so (the messages will simply be
dropped in `PeerManager`) there is a potential race condition where
the FundingLocked message enters the outbound message queue, then
the peer reconnects, and then the FundingLocked message is
delivered prior to the normal ChannelReestablish flow.

We also take this opportunity to rewrite
`test_funding_peer_disconnect` to be explicit instead of using
`reconnect_peers`. This allows it to check each message being sent
carefully, whereas `reconnect_peers` is rather lazy and accepts
that sometimes signatures will be exchanged, and sometimes not.

2 years agoReturn struct, not long tuple, from `Channel::channel_reestablish`
Matt Corallo [Sat, 13 Nov 2021 22:47:42 +0000 (22:47 +0000)]
Return struct, not long tuple, from `Channel::channel_reestablish`

This improves readability and makes it easier to add additional
return fields.

2 years agoMove node_id signing of ChannelAnnouncement into Signer
Matt Corallo [Sun, 14 Nov 2021 17:25:39 +0000 (17:25 +0000)]
Move node_id signing of ChannelAnnouncement into Signer

This removes one more place where we directly access the node_id
secret key in `ChannelManager`, slowly marching towards allowing
the node_id secret key to be offline in the signer.

More importantly, it allows more ChannelAnnouncement logic to move
into the `Channel` without having to pass the node secret key
around, avoiding the announcement logic being split across two
files.

2 years agoMerge pull request #1275 from jkczyz/2022-01-benchmark-improvements
valentinewallace [Tue, 25 Jan 2022 17:18:17 +0000 (12:18 -0500)]
Merge pull request #1275 from jkczyz/2022-01-benchmark-improvements

Router benchmark improvements

2 years agoMerge pull request #1251 from lightning-signer/2022-01-signer-preimages
Matt Corallo [Tue, 25 Jan 2022 17:12:05 +0000 (17:12 +0000)]
Merge pull request #1251 from lightning-signer/2022-01-signer-preimages

Provide payment preimages to signer on HTLC success

2 years agoBenchmark zero-penalty scorer
Jeffrey Czyz [Sun, 16 Jan 2022 16:16:19 +0000 (10:16 -0600)]
Benchmark zero-penalty scorer

2 years agoBenchmark router using a scorer seeded with data
Jeffrey Czyz [Mon, 17 Jan 2022 03:07:57 +0000 (21:07 -0600)]
Benchmark router using a scorer seeded with data

Scorers may have different performance characteristics after seeing
failed and successful paths. Seed the scorer with some random data
before executing the benchmark in order to exercise such behavior.

2 years agoAdd first_hops to generate_routes benchmarks
Jeffrey Czyz [Sun, 16 Jan 2022 16:04:11 +0000 (10:04 -0600)]
Add first_hops to generate_routes benchmarks

Passing first_hops to get_route increases the coverage of the benchmark
test. For scorers needing the sending node, it allows for using a single
scorer in the benchmark rather than re-initializing on each iteration.
As a consequence, the scorer can be seeded with success and failure
data.

2 years agoRemove duplicate generate_routes benchmark code
Jeffrey Czyz [Fri, 14 Jan 2022 18:28:30 +0000 (12:28 -0600)]
Remove duplicate generate_routes benchmark code

Refactor generate_routes and generate_mpp_routes into a single utility
for benchmarking. The utility is parameterized with features in order to
test both single path and multi-path routing. Additionally, it is
parameterized with a Score to be used with other scorers.

2 years agoProvide preimages to signer
Devrandom [Wed, 19 Jan 2022 11:19:27 +0000 (12:19 +0100)]
Provide preimages to signer

2 years agoKeep track of preimage in OutboundHTLCState on success
Devrandom [Tue, 18 Jan 2022 13:17:52 +0000 (14:17 +0100)]
Keep track of preimage in OutboundHTLCState on success

2 years agoMerge pull request #1272 from lightning-signer/2022-01-sign-invoice-api
valentinewallace [Mon, 24 Jan 2022 16:39:58 +0000 (11:39 -0500)]
Merge pull request #1272 from lightning-signer/2022-01-sign-invoice-api

Improve KeysInterface::sign_invoice API

2 years agoMerge pull request #1271 from tnull/rename_payee_struct
valentinewallace [Mon, 24 Jan 2022 16:34:48 +0000 (11:34 -0500)]
Merge pull request #1271 from tnull/rename_payee_struct

Rename `Payee` to `PaymentParameters`

2 years agoMerge pull request #1253 from TheBlueMatt/2022-01-background-persist-exit
valentinewallace [Mon, 24 Jan 2022 16:23:12 +0000 (11:23 -0500)]
Merge pull request #1253 from TheBlueMatt/2022-01-background-persist-exit

Persist `ChannelManager` before `BackgroundProcessor` exits

2 years agoImprove KeysInterface::sign_invoice API
Devrandom [Fri, 21 Jan 2022 10:33:39 +0000 (11:33 +0100)]
Improve KeysInterface::sign_invoice API

split hrp from invoice data, to allow parsing, since there is no delimiter between the two parts

2 years agoMerge pull request #1250 from vss96/sanity_check
Matt Corallo [Sat, 22 Jan 2022 18:19:35 +0000 (18:19 +0000)]
Merge pull request #1250 from vss96/sanity_check

Sanity check for ChannelManager and KeysInterface

2 years agoSanity check for ChannelManager and KeysInterface
vss96 [Tue, 18 Jan 2022 12:00:19 +0000 (17:30 +0530)]
Sanity check for ChannelManager and KeysInterface

Fix build errors

Create script using p2wsh for comparison

Using p2wpkh for generating the payment script

spendable_outputs sanity check

Return err in spendable_outputs

Doc updates in keysinterface

2 years agoMerge pull request #1269 from TheBlueMatt/022-01-no-disconnect-on-slow-persist
valentinewallace [Fri, 21 Jan 2022 16:52:05 +0000 (11:52 -0500)]
Merge pull request #1269 from TheBlueMatt/022-01-no-disconnect-on-slow-persist

Avoid disconnecting all peers if user code is slow

2 years agoRename `Payee` to `PaymentParameters`
Elias Rohrer [Fri, 21 Jan 2022 09:39:01 +0000 (10:39 +0100)]
Rename `Payee` to `PaymentParameters`

2 years agoIncrease our PING_TIMER to ten seconds, from five. 022-01-no-disconnect-on-slow-persist
Matt Corallo [Thu, 20 Jan 2022 23:42:56 +0000 (23:42 +0000)]
Increase our PING_TIMER to ten seconds, from five.

Because many lightning nodes can take quite some time to respond to
pings, the five second ping timer can sometimes cause spurious
disconnects even though a peer is online. However, in part as a
response to mobile users where a connection may be lost as result
of only a short time with the app in a "paused" state, we had a
rather aggressive ping time to ensure we would disconnect quickly.

However, since we now just used a fixed time for the "went to
sleep" detection, we can somewhat increase the ping timer. We still
want to be fairly aggressive to avoid sending HTLCs to a peer that
is offline, but the tradeoff between spurious disconnections and
stuck payments is likely doesn't need to be quite as aggressive.

2 years agoAvoid disconnecting all peers if user code is slow
Matt Corallo [Sun, 26 Sep 2021 00:09:17 +0000 (00:09 +0000)]
Avoid disconnecting all peers if user code is slow

In the sample client (and likely other downstream users), event
processing may block on slow operations (e.g. Bitcoin Core RPCs)
and ChannelManager persistence may take some time. This should be
fine, except that we consider this a case of possible backgrounding
and disconnect all of our peers when it happens.

Instead, we here avoid considering event processing time in the
time between PeerManager events.

2 years agoMerge pull request #1234 from tnull/limit_max_cltv_delta
Jeffrey Czyz [Thu, 20 Jan 2022 16:36:22 +0000 (10:36 -0600)]
Merge pull request #1234 from tnull/limit_max_cltv_delta

Limit maximum CLTV delta during routing

2 years agoMerge pull request #1248 from naveensrinivasan/naveen/feat/update-readme
Matt Corallo [Thu, 20 Jan 2022 16:34:01 +0000 (16:34 +0000)]
Merge pull request #1248 from naveensrinivasan/naveen/feat/update-readme

Docs: Updated README to include crates information

2 years agoLimit maximum total CLTV expiry delta during routing.
Elias Rohrer [Thu, 20 Jan 2022 15:00:00 +0000 (16:00 +0100)]
Limit maximum total CLTV expiry delta during routing.

2 years agoDocs: Updated README to include crates information
naveen [Tue, 18 Jan 2022 02:43:45 +0000 (02:43 +0000)]
Docs: Updated README to include crates information

Included crates information into README.

2 years agoMerge pull request #1258 from lightningdevkit/dependabot/cargo/hex-0.4
valentinewallace [Wed, 19 Jan 2022 18:19:59 +0000 (13:19 -0500)]
Merge pull request #1258 from lightningdevkit/dependabot/cargo/hex-0.4

Update hex requirement from 0.3 to 0.4

2 years agoFixed some typos
Elias Rohrer [Wed, 19 Jan 2022 17:15:47 +0000 (18:15 +0100)]
Fixed some typos

2 years agoPersist `ChannelManager` before `BackgroundProcessor` exits 2022-01-background-persist-exit
Matt Corallo [Tue, 18 Jan 2022 21:48:28 +0000 (21:48 +0000)]
Persist `ChannelManager` before `BackgroundProcessor` exits

Fixes #1237.

2 years agoUpdate hex requirement from 0.3 to 0.4
dependabot[bot] [Tue, 18 Jan 2022 22:05:49 +0000 (22:05 +0000)]
Update hex requirement from 0.3 to 0.4

Updates the requirements on [hex](https://github.com/KokaKiwi/rust-hex) to permit the latest version.
- [Release notes](https://github.com/KokaKiwi/rust-hex/releases)
- [Commits](https://github.com/KokaKiwi/rust-hex/compare/v0.3...v0.4.3)

---
updated-dependencies:
- dependency-name: hex
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoMerge pull request #1243 from naveensrinivasan/naveensrinivasan/dependabot
Arik Sosman [Tue, 18 Jan 2022 22:04:38 +0000 (14:04 -0800)]
Merge pull request #1243 from naveensrinivasan/naveensrinivasan/dependabot

Enable Dependabot

2 years agoCreate dependabot.yml
Naveen [Mon, 17 Jan 2022 01:32:04 +0000 (19:32 -0600)]
Create dependabot.yml

Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
2 years agoMerge pull request #1249 from tnull/fix_compile_warnings
valentinewallace [Tue, 18 Jan 2022 16:18:05 +0000 (11:18 -0500)]
Merge pull request #1249 from tnull/fix_compile_warnings

Fix compiler warning during building/testing.

2 years agoFix unused return warning for 'transmute_copy'.
Elias Rohrer [Tue, 18 Jan 2022 13:45:43 +0000 (14:45 +0100)]
Fix unused return warning for 'transmute_copy'.

2 years agoMerge pull request #1238 from TheBlueMatt/2022-01-lockorder-checks
Matt Corallo [Fri, 14 Jan 2022 16:59:42 +0000 (16:59 +0000)]
Merge pull request #1238 from TheBlueMatt/2022-01-lockorder-checks

Fix and test lockorder

2 years agoCheck lockorders in tests with a trivial lockorder tracker 2022-01-lockorder-checks
Matt Corallo [Thu, 13 Jan 2022 01:00:43 +0000 (01:00 +0000)]
Check lockorders in tests with a trivial lockorder tracker

2 years agoMerge pull request #1229 from lightning-signer/2021-12-htlc-anchor-sighashtype
Matt Corallo [Fri, 14 Jan 2022 04:10:14 +0000 (04:10 +0000)]
Merge pull request #1229 from lightning-signer/2021-12-htlc-anchor-sighashtype

anchors: Fix SigHashType and weight calculations for anchors

2 years agoFixed comment on weight_received_htlc
Ken Sedgwick [Thu, 13 Jan 2022 02:29:05 +0000 (18:29 -0800)]
Fixed comment on weight_received_htlc

2 years agoSet opt_anchors for calls to CommitmentTransaction::new_with_auxiliary_htlc_data
Ken Sedgwick [Thu, 13 Jan 2022 01:10:07 +0000 (17:10 -0800)]
Set opt_anchors for calls to CommitmentTransaction::new_with_auxiliary_htlc_data

2 years agoAdd anchor tests to outbound_commitment_test
Ken Sedgwick [Tue, 4 Jan 2022 22:53:44 +0000 (14:53 -0800)]
Add anchor tests to outbound_commitment_test

2 years agoDebit funder's output to cover anchors
Ken Sedgwick [Wed, 5 Jan 2022 00:05:28 +0000 (16:05 -0800)]
Debit funder's output to cover anchors

2 years agoConvert HTLC_{SUCCESS,TIMEOUT}_TX_WEIGHT to anchor-aware functions
Ken Sedgwick [Wed, 5 Jan 2022 21:40:08 +0000 (13:40 -0800)]
Convert HTLC_{SUCCESS,TIMEOUT}_TX_WEIGHT to anchor-aware functions

2 years agoConvert COMMITMENT_TX_BASE_WEIGHT to anchor-aware function
Ken Sedgwick [Tue, 4 Jan 2022 23:54:54 +0000 (15:54 -0800)]
Convert COMMITMENT_TX_BASE_WEIGHT to anchor-aware function

2 years agoAdd unit test coverage for package::weight_{offered,received}_htlc
Ken Sedgwick [Sun, 2 Jan 2022 23:00:54 +0000 (15:00 -0800)]
Add unit test coverage for package::weight_{offered,received}_htlc

2 years agomake WEIGHT{_REVOKED,}_{OFFERED,RECEIVED}_HTLC functions with opt_anchors parameter
Ken Sedgwick [Fri, 31 Dec 2021 20:21:22 +0000 (12:21 -0800)]
make WEIGHT{_REVOKED,}_{OFFERED,RECEIVED}_HTLC functions with opt_anchors parameter

2 years agoIsolated channelmonitor weight unit tests and added anchor loops
Ken Sedgwick [Fri, 31 Dec 2021 16:47:38 +0000 (08:47 -0800)]
Isolated channelmonitor weight unit tests and added anchor loops

2 years agoSet the SigHashType of remote htlc signatures w/ anchors to SinglePlusAnyoneCanPay
Ken Sedgwick [Wed, 29 Dec 2021 04:37:20 +0000 (20:37 -0800)]
Set the SigHashType of remote htlc signatures w/ anchors to SinglePlusAnyoneCanPay

2 years agoFix some (non-bug) lock-order-inversions in tests
Matt Corallo [Thu, 13 Jan 2022 01:51:29 +0000 (01:51 +0000)]
Fix some (non-bug) lock-order-inversions in tests

2 years agoMake lockorder consistent in channelmanager
Matt Corallo [Wed, 12 Jan 2022 19:58:08 +0000 (19:58 +0000)]
Make lockorder consistent in channelmanager

This resolves a lockorder inversion in
`ChannelManager::finalize_claims` where `pending_outbound_payments`
is locked after `pending_events`, opposite of, for example, the
lockorder in `ChannelManager::fail_htlc_backwards_internal` where
`pending_outbound_payments` is locked at the top of the
`HTLCSource::OutboundRoute` handling and then `pending_events` is
locked at the end.

2 years agoMerge pull request #1013 from TheBlueMatt/2021-07-warning-msgs
Matt Corallo [Tue, 11 Jan 2022 22:52:44 +0000 (22:52 +0000)]
Merge pull request #1013 from TheBlueMatt/2021-07-warning-msgs

2 years agoRely on Error/Warning message data lengths being correct 2021-07-warning-msgs
Matt Corallo [Fri, 7 Jan 2022 20:11:31 +0000 (20:11 +0000)]
Rely on Error/Warning message data lengths being correct

In https://github.com/lightning/bolts/pull/950, the (somewhat
strange) requirement that error messages be handled even if the
length field is set larger than the size of the package was
removed. Here we change the code to drop the special handling for
this, opting to just fail to read the message if the length is
incorrect.

2 years agoSend `warning` instead of `error` when we incounter bogus gossip
Matt Corallo [Fri, 7 Jan 2022 20:30:50 +0000 (20:30 +0000)]
Send `warning` instead of `error` when we incounter bogus gossip

2 years agoConvert `shutdown` invalid script checks to warning messages
Matt Corallo [Thu, 30 Sep 2021 22:45:07 +0000 (22:45 +0000)]
Convert `shutdown` invalid script checks to warning messages

As required by the warning messages PR, we should simply warn our
counterparty in this case and let them try again, continuing to try
to use the channel until they tell us otherwise.

2 years agoSend warning messages when appropriate in gossip handling pipeline
Matt Corallo [Thu, 22 Jul 2021 16:06:33 +0000 (16:06 +0000)]
Send warning messages when appropriate in gossip handling pipeline

2 years agoHandle sending and receiving warning messages
Matt Corallo [Thu, 22 Jul 2021 16:05:48 +0000 (16:05 +0000)]
Handle sending and receiving warning messages

2 years agoAdd a new `WarningMessage` message to send and receive warnings
Matt Corallo [Thu, 22 Jul 2021 15:25:13 +0000 (15:25 +0000)]
Add a new `WarningMessage` message to send and receive warnings

2 years agoMerge pull request #1230 from lightning-signer/2021-01-invoice-bech32-dep
Matt Corallo [Mon, 10 Jan 2022 18:34:40 +0000 (18:34 +0000)]
Merge pull request #1230 from lightning-signer/2021-01-invoice-bech32-dep

Do not turn on bech32/std by default for lightning-invoice

2 years agoDo not turn on bech32/std by default for lightning-invoice
Devrandom [Sun, 9 Jan 2022 11:26:14 +0000 (12:26 +0100)]
Do not turn on bech32/std by default for lightning-invoice

2 years agoMerge pull request #1223 from lightning-signer/2021-12-invoice-nostd
Matt Corallo [Thu, 6 Jan 2022 19:25:36 +0000 (19:25 +0000)]
Merge pull request #1223 from lightning-signer/2021-12-invoice-nostd

Adapt lightning-invoice to no_std

2 years agoAdapt lightning-invoice to no_std
Devrandom [Wed, 22 Dec 2021 16:43:25 +0000 (17:43 +0100)]
Adapt lightning-invoice to no_std

2 years agoMerge pull request #1226 from TheBlueMatt/2022-01-bindings-no-std
Matt Corallo [Wed, 5 Jan 2022 21:01:06 +0000 (21:01 +0000)]
Merge pull request #1226 from TheBlueMatt/2022-01-bindings-no-std

Support building `cfg=c_bindings` with `no-std`

2 years agoSupport building `cfg=c_bindings` with `no-std` 2022-01-bindings-no-std
Matt Corallo [Tue, 4 Jan 2022 22:34:15 +0000 (22:34 +0000)]
Support building `cfg=c_bindings` with `no-std`

This will be needed for JavaScript bindings eventually.

2 years agoMerge pull request #1220 from TheBlueMatt/2021-12-stale-update-gossip-log
Matt Corallo [Mon, 3 Jan 2022 19:54:20 +0000 (19:54 +0000)]
Merge pull request #1220 from TheBlueMatt/2021-12-stale-update-gossip-log

Log gossip rejections due to stale channel_updates at GOSSIP level

2 years agoMerge pull request #1225 from hackerrdave/update-repo-lightningdevkit
Matt Corallo [Wed, 29 Dec 2021 19:57:05 +0000 (19:57 +0000)]
Merge pull request #1225 from hackerrdave/update-repo-lightningdevkit

update repo name to use lightningdevkit

2 years agoupdate repo name to use lightningdevkit
hackerrdave [Mon, 27 Dec 2021 03:53:16 +0000 (22:53 -0500)]
update repo name to use lightningdevkit

2 years agoMerge pull request #1218 from TheBlueMatt/2021-12-minor-bindings-tweaks
Matt Corallo [Sun, 19 Dec 2021 23:55:09 +0000 (23:55 +0000)]
Merge pull request #1218 from TheBlueMatt/2021-12-minor-bindings-tweaks

Minor Bindings Tweaks

2 years agoLog gossip rejections due to stale channel_updates at GOSSIP level 2021-12-stale-update-gossip-log
Matt Corallo [Sun, 19 Dec 2021 20:13:38 +0000 (20:13 +0000)]
Log gossip rejections due to stale channel_updates at GOSSIP level

This further reduces noise at the TRACE level during initial gossip
sync.

2 years agoSwap around generic argument ordering in InvoicePayer for bindings 2021-12-minor-bindings-tweaks
Matt Corallo [Sat, 18 Dec 2021 19:52:11 +0000 (19:52 +0000)]
Swap around generic argument ordering in InvoicePayer for bindings

The bindings generation really should support generic bounds other
than Deref::Target 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.

2 years agoAdd a C-not exported tag to `NetGraphMsgHandler.network_graph`
Matt Corallo [Sat, 18 Dec 2021 03:43:34 +0000 (03:43 +0000)]
Add a C-not exported tag to `NetGraphMsgHandler.network_graph`

2 years agoAdd a constructor to MultiThreadedLockableScore
Matt Corallo [Sat, 18 Dec 2021 03:38:15 +0000 (03:38 +0000)]
Add a constructor to MultiThreadedLockableScore

...as otherwise the struct is rather useless.

2 years agoMerge pull request #1217 from TheBlueMatt/2021-12-0.0.104 v0.0.104
Matt Corallo [Fri, 17 Dec 2021 23:30:54 +0000 (23:30 +0000)]
Merge pull request #1217 from TheBlueMatt/2021-12-0.0.104

Cut 0.0.104

2 years agoSwap around generic argument ordering in DefaultRouter for bindings 2021-12-0.0.104
Matt Corallo [Fri, 17 Dec 2021 22:38:46 +0000 (22:38 +0000)]
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.

2 years agoBump versions to 0.0.104/invoice 0.12
Matt Corallo [Fri, 17 Dec 2021 21:28:24 +0000 (21:28 +0000)]
Bump versions to 0.0.104/invoice 0.12

2 years agoUpdate CHANGELOG for 0.0.104
Matt Corallo [Fri, 17 Dec 2021 01:49:39 +0000 (01:49 +0000)]
Update CHANGELOG for 0.0.104

2 years agoMerge pull request #1216 from valentinewallace/2021-12-preimage-getter
Matt Corallo [Fri, 17 Dec 2021 17:34:47 +0000 (17:34 +0000)]
Merge pull request #1216 from valentinewallace/2021-12-preimage-getter

Add utility for retrieving an LDK payment preimage

2 years agoRemove trailing whitespace in the FeeEstimator interface
Matt Corallo [Fri, 17 Dec 2021 00:32:28 +0000 (00:32 +0000)]
Remove trailing whitespace in the FeeEstimator interface

2 years agoinbound_payment: Add utility to get payment preimage given hash/secret
Valentine Wallace [Mon, 13 Dec 2021 23:40:16 +0000 (18:40 -0500)]
inbound_payment: Add utility to get payment preimage given hash/secret

User-requested feature

2 years agoinbound_payment: DRY verify method for use in getting preimage
Valentine Wallace [Mon, 13 Dec 2021 22:36:09 +0000 (17:36 -0500)]
inbound_payment: DRY verify method for use in getting preimage

in the next commit(s)

2 years agocreate_inbound_payment: warn about dup hashes
Valentine Wallace [Fri, 17 Dec 2021 00:27:13 +0000 (16:27 -0800)]
create_inbound_payment: warn about dup hashes

Leftover feedback from #1177

2 years agoSalt inbound payment ExpandedKey
Valentine Wallace [Fri, 17 Dec 2021 00:24:24 +0000 (16:24 -0800)]
Salt inbound payment ExpandedKey

Leftover feedback from #1177

2 years agoMerge pull request #1177 from valentinewallace/2021-11-derivable-payment-secret
Matt Corallo [Fri, 17 Dec 2021 00:15:24 +0000 (00:15 +0000)]
Merge pull request #1177 from valentinewallace/2021-11-derivable-payment-secret

Stop storing pending inbound payment data; instead make it derivable on receive

2 years agoAdd new invoice CreationError::InvalidAmount for use in checking `create_inbound_payment`
Valentine Wallace [Thu, 9 Dec 2021 22:41:33 +0000 (17:41 -0500)]
Add new invoice CreationError::InvalidAmount for use in checking `create_inbound_payment`

in an invoice creation utility. Note that if the error type of `create_inbound_payment` ever
changed, we'd be forced to update the invoice utility's callsite to handle the new error

2 years agoDrop need to store pending inbound payments
Valentine Wallace [Tue, 30 Nov 2021 00:59:18 +0000 (19:59 -0500)]
Drop need to store pending inbound payments

and replace payment_secret with encrypted metadata

See docs on `inbound_payment::verify` for details

Also add min_value checks to all create_inbound_payment* methods

2 years agoAdd get_single_block to chacha20 module
Valentine Wallace [Tue, 30 Nov 2021 00:36:59 +0000 (19:36 -0500)]
Add get_single_block to chacha20 module

In the next commit, we'll want to get a single block from a chacha stream that
takes a 16-byte nonce.

2 years agoMacro-ize checking that the total value of an MPP's parts is sane
Valentine Wallace [Mon, 22 Nov 2021 21:53:18 +0000 (16:53 -0500)]
Macro-ize checking that the total value of an MPP's parts is sane

This DRY-ed code will be used in upcoming commits when we stop storing inbound
payment data

2 years agoAdd get_inbound_payment_key_material to KeysInterface
Valentine Wallace [Mon, 29 Nov 2021 17:50:47 +0000 (12:50 -0500)]
Add get_inbound_payment_key_material to KeysInterface

This will allow us to retrieve key material for encrypting/decrypting inbound
payment info, in upcoming commits

2 years agoMerge pull request #1212 from TheBlueMatt/2021-12-timeout-graph
Matt Corallo [Thu, 16 Dec 2021 23:04:00 +0000 (23:04 +0000)]
Merge pull request #1212 from TheBlueMatt/2021-12-timeout-graph

Add a method to prune stale channels from NetworkGraph

2 years agoAutomatically prune NetworkGraph of stale channels hourly in BP 2021-12-timeout-graph
Matt Corallo [Wed, 15 Dec 2021 18:59:15 +0000 (18:59 +0000)]
Automatically prune NetworkGraph of stale channels hourly in BP

2 years agoReject channel_update messages with timestamps too old or new
Matt Corallo [Tue, 14 Dec 2021 01:33:37 +0000 (01:33 +0000)]
Reject channel_update messages with timestamps too old or new

Because we time out channel info that is older than two weeks now,
we should also reject new channel info that is older than two
weeks, in addition to rejecting future channel info.

2 years agoAdd a method to prune stale channels from `NetworkGraph`
Matt Corallo [Fri, 10 Dec 2021 06:46:29 +0000 (06:46 +0000)]
Add a method to prune stale channels from `NetworkGraph`

We define "stale" as "haven't heard an updated channel_update in
two weeks", as described in BOLT 7.

We also filter out stale channels at write-time for `std` users, as
we can look up the current time.

2 years agoDrop `allow_wallclock_use` feature in favor of simply using `std`
Matt Corallo [Fri, 10 Dec 2021 05:57:30 +0000 (05:57 +0000)]
Drop `allow_wallclock_use` feature in favor of simply using `std`

Fixes #1147.

2 years agoDRY up network_graph tests substantially with message creation fns
Matt Corallo [Wed, 15 Dec 2021 22:38:13 +0000 (22:38 +0000)]
DRY up network_graph tests substantially with message creation fns

2 years agoMerge pull request #1214 from TheBlueMatt/2021-12-fix-tokio-msrv-bump
Matt Corallo [Thu, 16 Dec 2021 17:44:21 +0000 (17:44 +0000)]
Merge pull request #1214 from TheBlueMatt/2021-12-fix-tokio-msrv-bump

2 years agoBuild no-std on 1.47 now that core2 supports it 2021-12-fix-tokio-msrv-bump
Matt Corallo [Thu, 16 Dec 2021 02:21:48 +0000 (02:21 +0000)]
Build no-std on 1.47 now that core2 supports it

2 years agoPin tokio to 1.14.0 in CI for older rustc's
Matt Corallo [Thu, 16 Dec 2021 02:10:09 +0000 (02:10 +0000)]
Pin tokio to 1.14.0 in CI for older rustc's

2 years agoMerge pull request #1148 from dunxen/2021-11-new-onion-errors
Matt Corallo [Wed, 15 Dec 2021 23:32:30 +0000 (23:32 +0000)]
Merge pull request #1148 from dunxen/2021-11-new-onion-errors

Add mpp_timeout and invalid_onion_payload descriptions

2 years agoMerge pull request #1211 from ConorOkus/2021-11-add-max-conversion
Conor Okus [Wed, 15 Dec 2021 16:15:21 +0000 (16:15 +0000)]
Merge pull request #1211 from ConorOkus/2021-11-add-max-conversion

Update docs to add max return value to conversion list

2 years agoMerge pull request #1202 from TheBlueMatt/2021-12-fix-retries-races
Matt Corallo [Wed, 15 Dec 2021 04:58:46 +0000 (04:58 +0000)]
Merge pull request #1202 from TheBlueMatt/2021-12-fix-retries-races

Fix payment retry races and inform users when a payment fails

2 years agoMake attempting to retry a succeeded payment an APIError, not Route 2021-12-fix-retries-races
Matt Corallo [Mon, 13 Dec 2021 17:41:36 +0000 (17:41 +0000)]
Make attempting to retry a succeeded payment an APIError, not Route

This is symmetric with the new failure once a payment is abandoned.

2 years agoUse `Event::PaymentFailed` in `InvoicePayer` to remove retry count
Matt Corallo [Sat, 4 Dec 2021 23:41:37 +0000 (23:41 +0000)]
Use `Event::PaymentFailed` in `InvoicePayer` to remove retry count

This finally fixes the bug described in the previous commits where
we retry a payment after its retry count has expired due to early
removal of the payment from the retry count tracking map. A test is
also added which demonstrates the bug in previous versions and
which passes now.

Fixes #1164.