Commit graph

3075 commits

Author SHA1 Message Date
Allan Douglas R. de Oliveira
963d6c4a51 Docs improvements 2023-03-21 14:11:13 +00:00
Matt Corallo
85b573ddad Add an optional_vec TLV format which makes sense, unlike vec_type
`vec_type` is confusing - it is happy to have a missing entry,
"reading" an empty `Vec` instead, but always writes something,
making a serialization round-trip different.

This is a problem for writing a new `Vec` which is
backwards-incompatible, but only if filled in. In that case we'd
really like the same read behavior, but not write anything if the
`Vec` is empty. Here we introduce such semantics via a new
`optional_vec` TLV format.
2023-03-20 23:29:22 +00:00
Matt Corallo
535dcc74b6 Remove unnecessary use in channelmonitor tests module 2023-03-20 20:08:29 +00:00
Matt Corallo
348e7274dc Remove unnecessary heap allocations in log-entry-matching tests 2023-03-20 20:07:18 +00:00
Wilmer Paulino
2cc48c5a3c
Add test for aggregated revoked HTLC claim on anchors channel 2023-03-20 11:32:15 -07:00
Wilmer Paulino
4be56b93b0
Maintain order of yielded claim events
Since the claim events are stored internally within a HashMap, they will
be yielded in a random order once dispatched. Claim events may be
invalidated if a conflicting claim has confirmed on-chain and we need to
generate a new claim event; the randomized order could result in the
new claim event being handled prior to the previous. To maintain the
order in which the claim events are generated, we track them in a Vec
instead and ensure only one instance of a PackageId only ever exists
within it.

This would have certain performance implications, but since we're
bounded by the total number of HTLCs in a commitment anyway, we're
comfortable with taking the cost.
2023-03-20 11:32:14 -07:00
Wilmer Paulino
7b9c28a021
Rename keys for OnchainTxHandler::claimable_outpoints map 2023-03-20 11:32:13 -07:00
Wilmer Paulino
1638c8b34a
Clarify OnchainEvent::Claim behavior
The previous documentation was slightly incorrect, a `Claim` can also be
from the counterparty if they happened to claim the same exact set of
outputs as a claiming transaction we generated.
2023-03-20 11:32:12 -07:00
Wilmer Paulino
7c446b4892
Add missing docs for BumpHTLCResolution 2023-03-20 11:32:09 -07:00
Wilmer Paulino
1958626744
Fix stale import behind anchors build tag 2023-03-20 11:32:07 -07:00
Wilmer Paulino
e7fb47b05a
Derive Eq on structs behind anchors build flag 2023-03-20 11:32:07 -07:00
Wilmer Paulino
cfa8941cc5
Implement PartialEq manually
Since we don't store `pending_claim_events` within `OnchainTxHandler` as
they'll be regenerated on restarts, we opt to implement `PartialEq`
manually such that the field is not longer considered.
2023-03-20 11:32:05 -07:00
Matt Corallo
48fa2fd172
Merge pull request #2024 from TheBlueMatt/2023-02-6conf-pub-hints
Include a route hint for public, not-yet-announced channels
2023-03-19 23:42:15 +00:00
Matt Corallo
cab6c976b6 Include a route hint for public, not-yet-announced channels
If we have a public channel which doesn't yet have six
confirmations the network can't possibly know about it as we cannot
have announced it yet. However, because we refuse to include
route-hints if we have any public channels, we will generate
invoices that no one can pay.

Thus, if we have any public, not-yet-announced channels, include
them as a route-hint.
2023-03-18 00:45:23 +00:00
Matt Corallo
217c3e09b3
Merge pull request #2107 from TheBlueMatt/2023-04-msrv-cleanup
Bump MSRV to 1.48 and replace most of CI with a bash script
2023-03-17 19:21:49 +00:00
Matt Corallo
12d799e6cb
Merge pull request #2094 from johncantrell97/expose-fee
expose `feerate_per_kw` in `ChannelDetails`
2023-03-15 21:16:23 +00:00
Matt Corallo
28cc71f980 Fix onion_message functional_tests no-std build 2023-03-15 19:19:49 +00:00
John Cantrell
d76b43fe44 expose feerate_sat_per_1000_weight in ChannelDetails
renames Channel::get_feerate to get_feerate_sat_per_1000_weight
2023-03-15 13:36:14 -04:00
Matt Corallo
2d213a47bf
Merge pull request #2045 from wpaulino/fix-broken-commitment-test-vectors
Update commitment test vectors
2023-03-14 19:01:59 +00:00
Matt Corallo
54f8895096
Merge pull request #2063 from valentinewallace/2023-03-remove-paymentpathfailed-retry
Remove `PaymentPathFailed::retry`
2023-03-13 23:01:38 +00:00
Matt Corallo
697f37dba6
Merge pull request #2091 from tnull/2023-03-expose-impl-writeable-tlv-based-enum-common 2023-03-13 16:32:19 +00:00
Valentine Wallace
f89b7d6fa9
Ensure payment_params present when checking is_retryable_now 2023-03-13 12:04:17 -04:00
Valentine Wallace
f6823c5541
Remove payment_params from send_payent_along_path
It's unused since it no longer inserts it into HTLCSource
2023-03-13 12:04:14 -04:00
Valentine Wallace
293964976a
Remove HTLCSource::OutboundRoute::payment_params
No longer used since it is no longer used to construct PaymentPathFailed events
2023-03-13 11:59:03 -04:00
Valentine Wallace
753e4ce3c3
Remove PaymentPathFailed::retry
We now support automatic retries in ChannelManager and no longer support manual
retries, so the field is useless.
2023-03-13 11:59:03 -04:00
Matt Corallo
10e6978b36 Further simplify the outbound_payments failure macro 2023-03-09 20:06:23 +00:00
Matt Corallo
6d6d2005f8 Correct outbound_payment route-fetch calls to pass the hash + ID
`Route::get_route_with_id` exists to provide users payment-specific
data when fetching a route, however we were failing to call it when
we have such info, opting for the simple `get_route` instead. This
defeats the purpose of the additional-metadata method, which we
swap to using here.
2023-03-09 19:23:58 +00:00
Elias Rohrer
5af4076d4c
Expose _impl_writeable_tlv_based_enum_common macro
As it isn't currently, and it's used by the exposed
`impl_writeable_tlv_based_enum`.
2023-03-09 16:11:56 +01:00
Matt Corallo
36834b3cef
Merge pull request #2079 from tnull/2023-03-add-list-channel-by-counterparty 2023-03-08 21:55:32 +00:00
Matt Corallo
dd11cae640
Merge pull request #2078 from AdvaitPote/bigsize_tests
Added encoding and decoding tests for BigSize
2023-03-08 20:03:58 +00:00
Advait
c593383627 encoding/decoding tests added for BigSize
removed unnecessary debugging line

using io::Cursor in place of the std one

encoding/decoding tests added for BigSize

made the code concise

encoding/decoding tests added for BigSize
2023-03-09 00:20:14 +05:30
Elias Rohrer
8419d13d4c
Add list_channels_by_counterparty method
While we already provide a `list_channels` method, it could result in
quite a large `Vec<ChannelDetails>`. Here, we provide the means to query
our channels by `counterparty_node_id` and DRY up the code.
2023-03-07 19:50:01 +01:00
Wilmer Paulino
5910802ccb
Update same amount and preimage test vector
The amount for HTLC #6 was updated in the spec's test vectors, but the
"same amount and preimage" test vector itself was not updated, even
though the new HTLC amount resulted in a different commitment
transaction, and thus, different signatures.
2023-03-06 10:59:51 -08:00
Wilmer Paulino
3fe9aadd9d
Add missing test vector for anchors_zero_fee_htlc_tx
Tests the case where only one anchor output exists for the funder in the
commitment transaction due to the remote having a dust balance (in this
case, 0).
2023-03-06 10:59:47 -08:00
Matt Corallo
7b2537bfcb
Merge pull request #2074 from TheBlueMatt/2023-03-fix-threaded-test
Make `fuzz_threaded_connections` more robust
2023-03-06 17:26:59 +00:00
Matt Corallo
c5cc1ede26
Merge pull request #2028 from TheBlueMatt/2023-02-macros-for-wilmer
Reduce macro usage in tests
2023-03-06 16:56:08 +00:00
Matt Corallo
d64e1b9027 Make fuzz_threaded_connections more robust
In `fuzz_threaded_connections`, if one thread is being run while
another is starved, and the running thread manages to call
`timer_tick_ocurred` twice after the starved thread constructs the
inbound connection but before it delivers the first bytes, we'll
receive an immediate error and `unwrap` it, causing failure.

The fix is trivial, simply remove the unwrap and return if we're
already disconnected when we do the initial read.

While we're here, we also reduce the frequency of the
`timer_tick_ocurred` calls to give us a chance to occasionally
deliver some additional messages.

Fixes #2073
2023-03-04 01:20:11 +00:00
Matt Corallo
af76face12
Merge pull request #2065 from TheBlueMatt/2023-02-0.0.114
Cut 0.0.114
2023-03-04 01:00:06 +00:00
Matt Corallo
a361be3544 Update crate versions to 0.0.114/invoice 0.22 2023-03-04 00:06:46 +00:00
Matt Corallo
4d2679fac6
Merge pull request #2072 from jkczyz/2023-01-fix-scoring-div-by-zero
Fix division by zero in `ProbabilisticScorer`
2023-03-04 00:06:29 +00:00
Matt Corallo
0188861585
Merge pull request #2071 from TheBlueMatt/2023-01-fix-fast-extra-ready-panic
Fix panic on receiving `channel_ready` after 1st commitment update
2023-03-03 23:32:42 +00:00
Jeffrey Czyz
bfd1a57434
Guard against division by zero in scorer
Since a node may announce that the htlc_maximum_msat of a channel is
zero, adding one to the denominator in the bucket formulas will prevent
the panic from ever happening. While the routing algorithm may never
select such a channel to score, this precaution may still be useful in
case the algorithm changes or if the scorer is used with a different
routing algorithm.
2023-03-03 16:25:57 -06:00
Jeffrey Czyz
e44868681d
Update scoring history buckets when no change
Even when there is no change in min/max liquidity knowledge, tracking
should still be updated to include the additional data point.
2023-03-03 16:25:17 -06:00
Matt Corallo
fac5373687
Merge pull request #2068 from jkczyz/2023-03-doc-fixes
Doc and build warning fixes
2023-03-03 22:19:59 +00:00
Matt Corallo
eed4c62f36
Merge pull request #2070 from TheBlueMatt/2023-03-get-key
Expose the node secret key in `{Phantom,}KeysManager`
2023-03-03 22:19:37 +00:00
Jeffrey Czyz
1d1323a3d0
Fix build warnings 2023-03-03 14:23:18 -06:00
Matt Corallo
029b66540a Expose the node secret key in {Phantom,}KeysManager
When we removed the private keys from the signing interface we
forgot to re-add them in the public interface of our own
implementations, which users may need.
2023-03-03 20:11:41 +00:00
Matt Corallo
41bcd68a40
Merge pull request #2066 from TheBlueMatt/2023-02-no-enum-refs
Pass `FailureCode` to `fail_htlc_backwards` by ownership
2023-03-03 19:44:40 +00:00
Matt Corallo
a9e6341f79
Merge pull request #2048 from TheBlueMatt/2023-02-send-persist-order-a
Track claimed outbound HTLCs in ChannelMonitors
2023-03-03 19:37:31 +00:00
Matt Corallo
0987b32bed Pass FailureCode to fail_htlc_backwards by ownership
`FaliureCode` is a trivial enum with no body, so we shouldn't be
passing it by reference. Its sufficiently strange that the Java
bindings aren't happy with it, which is fine, we should just fix it
here.
2023-03-03 17:20:58 +00:00