Commit graph

3576 commits

Author SHA1 Message Date
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
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
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
5626e21bea
Merge pull request #2536 from waterson/test-channel-signer
Rename EnforcingSigner to TestChannelSigner
2023-08-28 20:43:08 +00: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
jbesraa
3695b2aa13 Split LockableScore responsibilities between read & write operations
- Split Score from LockableScore to ScoreLookUp to handle read
      operations and ScoreUpdate to handle write operations
    - Change all struct that implemented Score to implement ScoreLookUp
      and/or ScoreUpdate
    - Change Mutex's to RwLocks to allow multiple data readers
    - Change LockableScore to Deref in ScorerAccountingForInFlightHtlcs
      as we only need to read
    - Add ScoreLookUp and ScoreUpdate docs
    - Remove reference(&'a) and Sized from Score in ScorerAccountingForInFlightHtlcs
      as Score implements Deref
    - Split MultiThreadedScoreLock into MultiThreadedScoreLockWrite and MultiThreadedScoreLockRead.
      After splitting LockableScore, we split MultiThreadedScoreLock following
      the same way, splitting a single score into two srtucts, one for read and
      other for write.
      MultiThreadedScoreLock is used in c_bindings.
2023-08-25 04:35:11 +03:00
Valentine Wallace
c9f5a75c8e
Router: account for blinded path fee, etc on first_hop<>intro hop add
This previously led to a debug panic in the router because we wouldn't account
for the blinded path fee when calculating first_hop<>intro_node hop's available
liquidity and construct an invalid path that forwarded more over said hop than
was actually available.

This also led to us hitting unreachable code, see direct_to_matching_intro_nodes
test description.
2023-08-24 11:38:30 -04:00
Lalitmohansharma1
b1abf32937 improving message in log 2023-08-24 20:21:08 +05:30
Matt Corallo
b315856e68 Make the P2PGossipSync UtxoLookup exchangable without &mut self
Because a `UtxoLookup` implementation is likely to need a reference
to the `PeerManager` which contains a reference to the
`P2PGossipSync`, it is likely to be impossible to get a mutable
reference to the `P2PGossipSync` by the time we want to add a
`UtxoLookup` without a ton of boilerplate and trait wrapping.

Instead, we simply place the `UtxoLookup` in a `RwLock`, allowing
us to modify it without a mutable self reference.

The lifetime bounds updates in tests required in this commit are
entirely unclear to me, but do allow tests to continue building, so
somehow make rustc happier.
2023-08-23 21:48:03 +00:00
Matt Corallo
bbe20c3327
Merge pull request #2515 from TheBlueMatt/2023-08-earlier-payment-hash-log
Include payment hash in more early payment logs
2023-08-23 21:46:23 +00:00
Matt Corallo
2bd2637b7e Store a HistoricalMinMaxBuckets in DirectedChannelLiquidity
This removes the need to reconstruct the struct in a number of
places by simply creating it up front.
2023-08-23 21:15:11 +00:00
Matt Corallo
2a1dff4c10 Move the bucketed history tracking logic into a scoring submodule 2023-08-23 21:15:11 +00:00