Commit graph

5924 commits

Author SHA1 Message Date
Jeffrey Czyz
6d0c5f00ba
Add an InvoiceRequestFailed event
When an invoice is requested but either receives an error or never
receives a response, surface an event to indicate to the user that the
corresponding future payment has failed.
2023-09-07 11:08:53 -05:00
Elias Rohrer
b5e959460f
Merge pull request #2134 from jbesraa/add_fromstr_to_netaddress
implement fromstr trait to netaddress
2023-09-07 14:16:25 +02:00
Matt Corallo
82d92ddaa0
Merge pull request #2557 from waterson/stale-monitor-force-close-debugging
Log each condition that was violated for a stale monitor
2023-09-07 04:10:59 +00:00
Chris Waterson
ff8c5dbe16 Fix misspelling, s/and/but/. 2023-09-06 15:10:51 -07:00
Matt Corallo
072a6fffb2
Merge pull request #2555 from tnull/2023-08-have-get-route-take-params
Have `get_route` and `Route` take `RouteParameters`
2023-09-06 20:22:08 +00:00
Elias Rohrer
543674f1da
Improve Route::get_total_amount docs 2023-09-06 19:35:39 +02:00
Elias Rohrer
6082b57097
Include overpaid value in Route::get_total_fees 2023-09-06 19:35:38 +02:00
Elias Rohrer
61cf75265e
Have Route hold RouteParameters 2023-09-06 19:35:38 +02:00
Elias Rohrer
266a3aa915
Have get_route take RouteParameters 2023-09-06 19:35:37 +02:00
jbesraa
4f45cdcad6 Implement from_str trait for NetAddress
- Add fuzz test for `NetAddress` `from_str` function
2023-09-06 19:25:30 +03:00
Chris Waterson
a70aa52b0a Log each condition that was violated for a stale monitor
There are several conditions that can be violated which indicate a stale
monitor. This logs each that doesn't hold.
2023-09-06 08:38:08 -07:00
jbesraa
32a0113fda Fix indent in message_signing.rs 2023-09-06 15:07:25 +03:00
jbesraa
b2d3b94b17 Move zbase32 implementation to base32 file 2023-09-06 15:07:25 +03:00
jbesraa
d736ca8595 Add RFC4648 base32 encode and decode functions 2023-09-06 15:07:25 +03:00
Matt Corallo
eb44d999ae
Merge pull request #1924 from benthecarman/handle-coinbase-funding-channel
Handle if funding output is in a coinbase transaction
2023-09-05 16:56:35 +00:00
Elias Rohrer
1d01e4747b
Merge pull request #2548 from JosephGoulden/chain-monitor-logging
Downgrade log message "Channel Monitor sync is still in progress" from info to debug
2023-09-05 09:19:27 +02:00
Duncan Dean
b28bf0b472
Add test for coinbase funding transactions 2023-09-04 17:13:50 +02:00
benthecarman
9a37135aee
Support creating coinbase funding transactions in tests 2023-09-04 17:13:24 +02:00
benthecarman
a2e01d5648
Handle if funding output is in a coinbase transaction 2023-09-04 17:13:23 +02:00
Joseph Goulden
25c0f489ae Downgrade log message regarding Channel Monitor sync still being in progress from info to debug 2023-09-03 12:48:56 +01:00
Matt Corallo
e9d9711de4
Merge pull request #2522 from sr-gi/202308-set-feature
Adds a set of convenience methods to set non-custom features
2023-09-01 18:25:53 +00:00
Matt Corallo
ef8945e339
Merge pull request #2543 from optout21/txabort-typo
[minor] Fix wrong msg type in SendTxAbort, typo
2023-09-01 15:13:54 +00:00
Sergi Delgado Segura
992f1029ac Adds a set of convenience methods to set non-custom features
Currently only custom features can be set by specifying the feature bit. Add also the
ability to do so for regular features.
2023-09-01 11:30:21 +02:00
Elias Rohrer
b3612b83c4
Add constructor to RouteParameters 2023-09-01 10:35:42 +02:00
optout
8952446684
Fix wrong msg type in SendTxAbort, typo 2023-09-01 00:00:13 +02:00
Matt Corallo
073f0780f6
Merge pull request #2468 from jkczyz/2023-08-offer-payment-id
Offer outbound payments
2023-08-29 19:29:21 +00:00
Jeffrey Czyz
7a3e06b1e7
Include PaymentId in payer metadata
When receiving a BOLT 12 invoice originating from either an invoice
request or a refund, the invoice should only be paid once. To accomplish
this, require that the invoice includes an encrypted payment id in the
payer metadata. This allows ChannelManager to track a payment when
requesting but prior to receiving the invoice. Thus, it can determine if
the invoice has already been paid.
2023-08-29 11:08:11 -05:00
Jeffrey Czyz
861e0eee9e
Add a ChaCha20 utility for encrypting in place
Similar to ChaCha20::encrypt_single_block only encrypts in-place.
2023-08-29 11:08:11 -05:00
Jeffrey Czyz
4732484520
Add a ChaCha20 utility for encrypting a block
This hides an encryption implementation detail from callers.
2023-08-29 11:08:11 -05:00
Jeffrey Czyz
4fafae0733
Add an encryption key to ExpandedKey for Offers
Metadata such as the PaymentId should be encrypted when included in an
InvoiceRequest or a Refund, as it is user data and is exposed to the
payment recipient. Add an encryption key to ExpandedKey for this purpose
instead of reusing offers_base_key.
2023-08-29 11:08:11 -05:00
Jeffrey Czyz
971cb20d2e
Remove unnecessary #[allow(unused)] 2023-08-29 11:08:11 -05:00
Jeffrey Czyz
21fa551825
Split InvoiceRequest::verify_and_respond_using_derived_keys
InvoiceRequest::verify_and_respond_using_derived_keys takes a payment
hash. To avoid generating one for invoice requests that ultimately
cannot be verified, split the method into one for verifying and another
for responding.
2023-08-29 11:08:04 -05:00
Elias Rohrer
1f2ee2170f
Merge pull request #2531 from optout21/channel-id-breaking
Add ChannelId pending change note; formatting
2023-08-29 13:30:46 +02:00
Matt Corallo
e57fbba754
Merge pull request #2537 from TheBlueMatt/2023-08-one-less-feature-dep
Drop dep `tokio`'s `io-util` feat as it broke MSRV and isn't useful
2023-08-29 00:20:44 +00:00
Matt Corallo
afc5a02fc6 Pin the memchr test-only transitive dependency of regex 2023-08-28 21:16:54 +00:00
Matt Corallo
eb882a69b6 Drop dep tokio's io-util feat as it broke MSRV and isn't useful
We use `tokio`'s `io-util` feature to provide the
`Async{Read,Write}Ext` traits, which allow us to simply launch a
read future or `poll_write` directly as well as `split` the
`TcpStream` into a read/write half. However, these traits aren't
actually doing much for us - they are really just wrapping the
`readable` future (which we can trivially use ourselves) and
`poll_write` isn't doing anything for us that `poll_write_ready`
can't.

Similarly, the split logic is actually just `Arc`ing the
`TcpStream` and busy-waiting when an operation is busy to prevent
concurrent reads/writes. However, there's no reason to prevent
concurrent access at the stream level - we aren't ever concurrently
writing or reading (though we may concurrently read and write,
which is fine).

Worse, the `io-util` feature broke MSRV (though they're likely to
fix this upstream) and carries two additional dependencies (only
one on the latest upstream tokio).

Thus, we simply drop the dependency here.

Fixes #2527.
2023-08-28 21:16:54 +00:00
Matt Corallo
5626e21bea
Merge pull request #2536 from waterson/test-channel-signer
Rename EnforcingSigner to TestChannelSigner
2023-08-28 20:43:08 +00:00
Valentine Wallace
911113814f
Fix BlindedPath::new_for_payment docs 2023-08-28 13:20:11 -04:00
Matt Corallo
2c4f82478e
Merge pull request #2528 from arik-so/arik/2023-08-2470-shorter-term-monitor-locks
Release monitor write lock in between update iterations
2023-08-28 17:07:03 +00:00
Chris Waterson
e38916d838 Rename EnforcingSigner to TestChannelSigner
Since the advent of VLS, EnforcingSigner is only used now for testing.
2023-08-28 09:48:35 -07:00
optout
d5d336f215
Add ChannelId pending change note; formatting 2023-08-28 07:20:23 +02:00
Arik Sosman
f80284cc88
Fix flaky aggregated HTLC revocation test.
Releasing write locks in between monitor updates
requires storing a set of cloned keys to iterate
over. For efficiency purposes, that set of keys
is an actual set, as opposed to array, which means
that the iteration order may not be consistent.

The test was relying on an event array index to
access the revocation transaction. We change that
to accessing a hash map keyed by the txid, fixing
the test.
2023-08-27 10:24:38 -07:00
Arik Sosman
c7a4949a25
Release write lock between monitor update iterations.
Previously, updating block data on a chain monitor
would acquire a write lock on all of its associated
channel monitors and not release it until the loop
completed.

Now, we instead acquire it on each iteration,
fixing #2470.
2023-08-27 10:24:37 -07:00
Matt Corallo
61d896d519
Merge pull request #2485 from optout21/channel-id-4struct1
Introduce new ChannelId struct
2023-08-27 05:18:00 +00:00
optout
e99e6ab562
Use new ChannelId type 2023-08-26 01:30:40 +02:00
optout
7a992ba40f
Add new ChannelId type; unused 2023-08-26 01:15:46 +02:00
Matt Corallo
afdcd1c198
Merge pull request #2197 from jbesraa/feat/lockable_score_rw
add another lock to lockable_score
2023-08-25 18:48:49 +00:00
Elias Rohrer
3dffe54258
Merge pull request #2248 from TheBlueMatt/2023-04-gossip-check
Implement the UtxoSource interface for REST/RPC clients
2023-08-25 14:10:39 +02:00
Elias Rohrer
d9eb201bd8
Merge pull request #2503 from valentinewallace/2023-08-fix-router-debug-panic
Fix debug panic in the case where a first hop has a channel with an introduction node
2023-08-25 12:46:37 +02:00
Elias Rohrer
af3a369ef1
Merge pull request #2466 from TheBlueMatt/2023-07-expose-success-prob
Expose the historical success probability calculation itself
2023-08-25 12:40:36 +02:00