Matt Corallo [Fri, 17 Sep 2021 17:32:11 +0000 (17:32 +0000)]
Support de/ser of the new channel_type field in open_channel
Matt Corallo [Fri, 17 Sep 2021 16:59:09 +0000 (16:59 +0000)]
Add a ChannelTypeFeatures features object for the new channel_type
Its semantics are somewhat different from existing features,
however not enough to merit a different struct entirely.
Specifically, it only supports required features (if you send a
channel_type, the counterparty has to accept it wholesale or try
again, it cannot select only a subset of the flags) and it is
serialized differently (only appearing in TLVs).
Matt Corallo [Fri, 17 Sep 2021 16:00:24 +0000 (16:00 +0000)]
Fix `cargo doc` on older rustc
Apparently at least rustc 1.48 doesn't support `Self` in doc links,
so we make it explicit.
Matt Corallo [Fri, 22 Oct 2021 19:33:33 +0000 (19:33 +0000)]
Merge pull request #1104 from TheBlueMatt/2021-10-payment-id-in-monitors
Reload pending outbound payments from ChannelMonitors on startup
Matt Corallo [Wed, 20 Oct 2021 23:40:09 +0000 (23:40 +0000)]
Add a test of an HTLC being fulfilled and then later failed
Peers probably shouldn't do this, but if they want to give us free
money, we should take it and not generate any spurious events.
Matt Corallo [Sun, 10 Oct 2021 23:42:03 +0000 (23:42 +0000)]
Move test_dup_htlc_onchain_fails_on_reload to payment_tests
test_dup_htlc_onchain_fails_on_reload is now more of a
payment_test than a functional_test, testing for handling of
pending payments.
Matt Corallo [Sun, 10 Oct 2021 23:36:57 +0000 (23:36 +0000)]
Add some basic test coverage of monitor payment data reloading
Matt Corallo [Sun, 10 Oct 2021 23:36:44 +0000 (23:36 +0000)]
Reload pending payments from ChannelMonitor HTLC data on reload
If we go to send a payment, add the HTLC(s) to the channel(s),
commit the ChannelMonitor updates to disk, and then crash, we'll
come back up with no pending payments but HTLC(s) ready to be
claim/failed.
This makes it rather impractical to write a payment sender/retryer,
as you cannot guarantee atomicity - you cannot guarantee you'll
have retry data persisted even if the HTLC(s) are actually pending.
Because ChannelMonitors are *the* atomically-persisted data in LDK,
we lean on their current HTLC data to figure out what HTLC(s) are a
part of an outbound payment, rebuilding the pending payments list
on reload.
Matt Corallo [Mon, 4 Oct 2021 04:04:46 +0000 (04:04 +0000)]
Add PaymentSecrets to HTLCSource::OutboundRoute objects
Matt Corallo [Thu, 21 Oct 2021 19:05:48 +0000 (19:05 +0000)]
Rename payment object vars to refer to payments and not session IDs
Matt Corallo [Sun, 3 Oct 2021 22:33:12 +0000 (22:33 +0000)]
Track payments after they resolve until all HTLCs are finalized
In the next commit, we will reload lost pending payments from
ChannelMonitors during restart. However, in order to avoid
re-adding pending payments which have already been fulfilled, we
must ensure that we do not fully remove pending payments until all
HTLCs for the payment have been fully removed from their
ChannelMonitors.
We do so here, introducing a new PendingOutboundPayment variant
called `Completed` which only tracks the set of pending HTLCs.
Matt Corallo [Sat, 2 Oct 2021 22:35:07 +0000 (22:35 +0000)]
Inform ChannelManager when fulfilled HTLCs are finalized
When an HTLC has been failed, we track it up until the point there
exists no broadcastable commitment transaction which has the HTLC
present, at which point Channel returns the HTLCSource back to the
ChannelManager, which fails the HTLC backwards appropriately.
When an HTLC is fulfilled, however, we fulfill on the backwards path
immediately. This is great for claiming upstream HTLCs, but when we
want to track pending payments, we need to ensure we can check with
ChannelMonitor data to rebuild pending payments. In order to do so,
we need an event similar to the HTLC failure event, but for
fulfills instead.
Specifically, if we force-close a channel, we remove its off-chain
`Channel` object entirely, at which point, on reload, we may notice
HTLC(s) which are not present in our pending payments map (as they
may have received a payment preimage, but not fully committed to
it). Thus, we'd conclude we still have a retryable payment, which
is untrue.
This commit does so, informing the ChannelManager via a new return
element where appropriate of the HTLCSource corresponding to the
failed HTLC.
Matt Corallo [Sun, 3 Oct 2021 00:46:10 +0000 (00:46 +0000)]
Implement `HashMap` read for `MaybeReadable` values
This allows us to read a `HashMap` that has values which may be
skipped if they are some backwards-compatibility type.
We also take this opportunity to fail deserialization if keys are
duplicated.
Matt Corallo [Sun, 10 Oct 2021 23:56:11 +0000 (23:56 +0000)]
Make `Channel::monitor_updating_restored`'s return tuple a struct
This improves readability at the callsite and in the function.
Matt Corallo [Sat, 2 Oct 2021 01:59:38 +0000 (01:59 +0000)]
Make `Channel::revoke_and_ack`'s return tuple a struct
This substantially improves readability at the callsite and in the
function.
Matt Corallo [Wed, 20 Oct 2021 00:53:26 +0000 (00:53 +0000)]
Merge pull request #1108 from TheBlueMatt/2021-10-persist-mon-blocks
Persist ChannelMonitors after new blocks are connected
Matt Corallo [Tue, 19 Oct 2021 21:49:03 +0000 (21:49 +0000)]
Clarify the contexts in which persist_new_channel may be called
Its somewhat confusing that `persist_new_channel` is called on
startup for an existing channel in common deployments, so we call
it out explicitly.
Matt Corallo [Thu, 14 Oct 2021 23:38:08 +0000 (23:38 +0000)]
Always release `MonitorEvent`s to `ChannelManager` after 3 blocks
If we have a `ChannelMonitor` update from an on-chain event which
returns a `TemporaryFailure`, we block `MonitorEvent`s from that
`ChannelMonitor` until the update is persisted. This prevents
duplicate payment send events to the user after payments get
reloaded from monitors on restart.
However, if the event being avoided isn't going to generate a
PaymentSent, but instead result in us claiming an HTLC from an
upstream channel (ie the HTLC was forwarded), then the result of a
user delaying the event is that we delay getting our money, not a
duplicate event.
Because user persistence may take an arbitrary amount of time, we
need to bound the amount of time we can possibly wait to return
events, which we do here by bounding it to 3 blocks.
Thanks to Val for catching this in review.
Matt Corallo [Sun, 10 Oct 2021 18:02:17 +0000 (18:02 +0000)]
Update test_dup_htlc_onchain_fails_on_reload for new persist API
ChannelMonitors now require that they be re-persisted before
MonitorEvents be provided to the ChannelManager, the exact thing
that test_dup_htlc_onchain_fails_on_reload was testing for when it
*didn't* happen. As such, test_dup_htlc_onchain_fails_on_reload is
now testing that we bahve correctly when the API guarantees are not
met, something we don't need to do.
Here, we adapt it to test the new API requirements through
ChainMonitor's calls to the Persist trait instead.
Matt Corallo [Wed, 13 Oct 2021 20:05:48 +0000 (20:05 +0000)]
Persist `ChannelMonitor`s after new blocks are connected
This resolves several user complaints (and issues in the sample
node) where startup is substantially delayed as we're always
waiting for the chain data to sync.
Further, in an upcoming PR, we'll be reloading pending payments
from ChannelMonitors on restart, at which point we'll need the
change here which avoids handling events until after the user
has confirmed the `ChannelMonitor` has been persisted to disk.
It will avoid a race where we
* send a payment/HTLC (persisting the monitor to disk with the
HTLC pending),
* force-close the channel, removing the channel entry from the
ChannelManager entirely,
* persist the ChannelManager,
* connect a block which contains a fulfill of the HTLC, generating
a claim event,
* handle the claim event while the `ChannelMonitor` is being
persisted,
* persist the ChannelManager (before the CHannelMonitor is
persisted fully),
* restart, reloading the HTLC as a pending payment in the
ChannelManager, which now has no references to it except from
the ChannelMonitor which still has the pending HTLC,
* replay the block connection, generating a duplicate PaymentSent
event.
Matt Corallo [Thu, 7 Oct 2021 23:59:47 +0000 (23:59 +0000)]
Use an opaque type to describe monitor updates in Persist
In the next commit, we'll be originating monitor updates both from
the ChainMonitor and from the ChannelManager, making simple
sequential update IDs impossible.
Further, the existing async monitor update API was somewhat hard to
work with - instead of being able to generate monitor_updated
callbacks whenever a persistence process finishes, you had to
ensure you only did so at least once all previous updates had also
been persisted.
Here we eat the complexity for the user by moving to an opaque
type for monitor updates, tracking which updates are in-flight for
the user and only generating monitor-persisted events once all
pending updates have been committed.
Matt Corallo [Thu, 7 Oct 2021 18:51:49 +0000 (18:51 +0000)]
Move ChannelManager::monitor_updated to a MonitorEvent
In the next commit we'll need ChainMonitor to "see" when a monitor
persistence completes, which means `monitor_updated` needs to move
to `ChainMonitor`. The simplest way to then communicate that
information to `ChannelManager` is via `MonitorEvet`s, which seems
to line up ok, even if they're now constructed by multiple
different places.
Matt Corallo [Tue, 19 Oct 2021 21:55:49 +0000 (21:55 +0000)]
Merge pull request #1133 from jkczyz/2021-10-expand-scorer
Include source and destination nodes in routing::Score
Jeffrey Czyz [Mon, 18 Oct 2021 23:36:35 +0000 (18:36 -0500)]
Add source and target nodes to routing::Score
Expand routing::Score::channel_penalty_msat to include the source and
target node ids of the channel. This allows scorers to avoid certain
nodes altogether if desired.
Jeffrey Czyz [Sat, 16 Oct 2021 02:31:33 +0000 (21:31 -0500)]
Simplify prefers_shorter_route_with_higher_fees
In order to make the scoring tests easier to read, only check the
relevant RouteHop fields. The remaining fields are tested elsewhere.
Expand the test to show the path used without scoring.
Matt Corallo [Fri, 8 Oct 2021 22:54:32 +0000 (22:54 +0000)]
Move the two-AtomicUsize counter in peer_handler to a util struct
We also take this opportunity to drop byte_utils::le64_to_array, as
our MSRV now supports the native to_le_bytes() call.
Matt Corallo [Thu, 7 Oct 2021 04:14:35 +0000 (04:14 +0000)]
Move MonitorEvent serialization to TLV-enum-upgradable from custom
Matt Corallo [Mon, 18 Oct 2021 19:23:25 +0000 (19:23 +0000)]
Merge pull request #1127 from TheBlueMatt/2021-10-0.0.102
Cut 0.0.102
Matt Corallo [Sat, 16 Oct 2021 00:23:33 +0000 (00:23 +0000)]
Bump crate versions to 0.0.102 and lightning-invoice 0.10
Matt Corallo [Sat, 16 Oct 2021 00:21:57 +0000 (00:21 +0000)]
Add CHANGELOG entries for 0.0.102
Matt Corallo [Sat, 16 Oct 2021 02:15:07 +0000 (02:15 +0000)]
Merge pull request #1121 from TheBlueMatt/2021-10-return-temp-id
Expose temporary channel ID and user channel ID pre-funding
Matt Corallo [Sat, 16 Oct 2021 01:58:15 +0000 (01:58 +0000)]
Merge pull request #1124 from jkczyz/2021-10-default-channel-scoring
Add channel scoring to get_route
Matt Corallo [Fri, 15 Oct 2021 20:16:15 +0000 (20:16 +0000)]
Rename create_channel param to user_channel_id to standardize it
Matt Corallo [Fri, 15 Oct 2021 22:07:34 +0000 (22:07 +0000)]
Merge pull request #1123 from tnull/fix_video_url
Fixed 'Advancing Bitcoin' video URL.
Jeffrey Czyz [Mon, 27 Sep 2021 20:52:57 +0000 (13:52 -0700)]
Add channel scoring to get_route
Failed payments may be retried, but calling get_route may return a Route
with the same failing path. Add a routing::Score trait used to
parameterize get_route, which it calls to determine how much a channel
should be penalized in terms of msats willing to pay to avoid the
channel.
Also, add a Scorer struct that implements routing::Score with a constant
constant penalty. Subsequent changes will allow for more robust scoring
by feeding back payment path success and failure to the scorer via event
handling.
Elias Rohrer [Thu, 14 Oct 2021 08:35:12 +0000 (10:35 +0200)]
Fixed 'Advancing Bitcoin' video URL.
Matt Corallo [Thu, 14 Oct 2021 01:45:20 +0000 (01:45 +0000)]
Merge pull request #1112 from TheBlueMatt/2021-10-mon-refactors
Hide internals of ChainMonitor behind getter
Matt Corallo [Sat, 9 Oct 2021 00:23:44 +0000 (00:23 +0000)]
Use Persister to return errors in fuzzers not chain::Watch
Matt Corallo [Fri, 8 Oct 2021 06:16:28 +0000 (06:16 +0000)]
Use Persister to return errors in tests not chain::Watch
As ChainMonitor will need to see those errors in a coming PR,
we need to return errors via Persister so that our ChainMonitor
chain::Watch implementation sees them.
Matt Corallo [Fri, 8 Oct 2021 20:40:34 +0000 (20:40 +0000)]
Handle Persister returning TemporaryFailure for new channels
Previously, if a Persister returned a TemporaryFailure error when
we tried to persist a new channel, the ChainMonitor wouldn't track
the new ChannelMonitor at all, generating a PermanentFailure later
when the updating is restored.
This fixes that by correctly storing the ChannelMonitor on
TemporaryFailures, allowing later update restoration to happen
normally.
This is (indirectly) tested in the next commit where we use
Persister to return all monitor-update errors.
Matt Corallo [Fri, 8 Oct 2021 05:17:48 +0000 (05:17 +0000)]
Simplify channelmonitor tests which use chain::Watch and Persister
test_simple_monitor_permanent_update_fail and
test_simple_monitor_temporary_update_fail both have a mode where
they use either chain::Watch or persister to return errors.
As we won't be doing any returns directly from the chain::Watch
wrapper in a coming commit, the chain::Watch-return form of the
test will no longer make sense.
Matt Corallo [Fri, 8 Oct 2021 19:07:00 +0000 (19:07 +0000)]
Make `ChainMonitor::monitors` private and expose monitor via getter
Exposing a `RwLock<HashMap<>>` directly was always a bit strange,
and in upcoming changes we'd like to change the internal
datastructure in `ChainMonitor`.
Further, the use of `RwLock` and `HashMap` meant we weren't able
to expose the ChannelMonitors themselves to users in bindings,
leaving a bindings/rust API gap.
Thus, we take this opportunity go expose ChannelMonitors directly
via a wrapper, hiding the internals of `ChainMonitor` behind
getters. We also update tests to use the new API.
Matt Corallo [Tue, 5 Oct 2021 17:59:13 +0000 (17:59 +0000)]
Move ChannelMonitorUpdateErr to chain as it is a chain::Watch val
Matt Corallo [Thu, 7 Oct 2021 23:46:13 +0000 (23:46 +0000)]
Move `Persist` trait to chainmonitor as that's the only reference
Matt Corallo [Thu, 14 Oct 2021 00:16:27 +0000 (00:16 +0000)]
Merge pull request #1120 from jkczyz/2021-10-test-refactors
Pre-scoring test clean-ups
Jeffrey Czyz [Wed, 13 Oct 2021 17:19:14 +0000 (12:19 -0500)]
Move mpp_failure test to payment_tests.rs
Jeffrey Czyz [Mon, 27 Sep 2021 20:02:51 +0000 (13:02 -0700)]
Replace get_route with get_route_and_payment_hash
The interface for get_route will change to take a scorer. Using
get_route_and_payment_hash whenever possible allows for keeping the
scorer inside get_route_and_payment_hash rather than at every call site.
Replace get_route with get_route_and_payment_hash wherever possible.
Additionally, update get_route_and_payment_hash to use the known invoice
features and the sending node's logger.
Matt Corallo [Wed, 13 Oct 2021 21:34:19 +0000 (21:34 +0000)]
Include the user channel id counter in Event::ChannelClosed
This makes it more practical for users to track channels using
their own IDs, especially across funding.
Matt Corallo [Wed, 13 Oct 2021 21:14:35 +0000 (21:14 +0000)]
Return the temporary channel id in success from `create_channel`
This makes it more practical for users to track channels prior to
funding, especially if the channel fails because the peer rejects
it for a parameter mismatch.
Matt Corallo [Wed, 13 Oct 2021 16:54:09 +0000 (16:54 +0000)]
Merge pull request #1115 from TheBlueMatt/2021-10-expose-addr-vec
Expose ReadOnlyNetworkGraph::get_addresses to C by cloning result
Jeffrey Czyz [Fri, 8 Oct 2021 19:24:19 +0000 (14:24 -0500)]
Fix unused variable warnings in fuzzer
Jeffrey Czyz [Mon, 4 Oct 2021 21:06:38 +0000 (16:06 -0500)]
Speed up test_timer_tick_called
Matt Corallo [Mon, 11 Oct 2021 23:46:51 +0000 (23:46 +0000)]
Expose ReadOnlyNetworkGraph::get_addresses to C by cloning result
We cannot expose ReadOnlyNetworkGraph::get_addresses as is in C as
it returns a list of references to an enum, which the bindings
dont support. Instead, we simply clone the result so that it
doesn't contain references.
Matt Corallo [Wed, 13 Oct 2021 01:13:41 +0000 (01:13 +0000)]
Merge pull request #1077 from jkczyz/2021-09-failing-route-hop
Include short channel id in PaymentPathFailed
Jeffrey Czyz [Thu, 16 Sep 2021 04:22:44 +0000 (23:22 -0500)]
Add failing short channel id to PaymentPathFailed
This will be useful for scoring channels when a payment fails.
Matt Corallo [Tue, 12 Oct 2021 18:29:05 +0000 (18:29 +0000)]
Merge pull request #1116 from TheBlueMatt/2021-10-test-local-chan-routing
Use local channel state when constructing routes in test macro + Fix compile-warning
Matt Corallo [Sat, 9 Oct 2021 20:14:13 +0000 (20:14 +0000)]
Fix loop label shadowing warning
Matt Corallo [Tue, 12 Oct 2021 02:29:01 +0000 (02:29 +0000)]
Use local channel state when constructing routes in test macro
This is a bit more realistic and needed to route over non-public
channels.
Jeffrey Czyz [Mon, 11 Oct 2021 18:18:49 +0000 (13:18 -0500)]
Clean up fee_insufficient computation
Matt Corallo [Sat, 9 Oct 2021 17:17:55 +0000 (17:17 +0000)]
Merge pull request #1098 from 1nF0rmed/2021-09-adds-discard-funding-event
Add Event::DiscardFunding generation
1nF0rmed [Mon, 27 Sep 2021 16:50:07 +0000 (22:20 +0530)]
Adds DiscardFunding event
During the event of a channel close, if the funding transaction
is yet to be broadcasted then a DiscardFunding event is issued
along with the ChannelClose event.
Matt Corallo [Fri, 8 Oct 2021 21:02:53 +0000 (21:02 +0000)]
Merge pull request #1107 from dunxen/2021-10-swap-pubkey-for-bytearray
Replace PublicKey with [u8; 33] in NetworkGraph
Matt Corallo [Fri, 8 Oct 2021 20:49:19 +0000 (20:49 +0000)]
Merge pull request #1062 from galderz/t_payment_hash_999
Duncan Dean [Tue, 5 Oct 2021 20:40:34 +0000 (22:40 +0200)]
Replace PublicKey with [u8; 33] in NetworkGraph
Galder Zamarreño [Tue, 31 Aug 2021 07:56:21 +0000 (08:56 +0100)]
Add payment_hash to PaymentSent #999
Matt Corallo [Thu, 7 Oct 2021 23:14:06 +0000 (23:14 +0000)]
Merge pull request #1109 from TheBlueMatt/2021-10-init-fail-payment-retry-leak
Move pending payment tracking to after the new HTLC flies
Matt Corallo [Tue, 5 Oct 2021 22:28:32 +0000 (22:28 +0000)]
Correct error returned when `retry_payment` doesn't have a payment
Matt Corallo [Mon, 4 Oct 2021 04:47:33 +0000 (04:47 +0000)]
Move pending payment tracking to after the new HTLC flies
If we attempt to send a payment, but the HTLC cannot be send due to
local channel limits, we'll provide the user an error but end up
with an entry in our pending payment map. This will result in a
memory leak as we'll never reclaim the pending payment map entry.
Jeffrey Czyz [Tue, 14 Sep 2021 16:44:19 +0000 (11:44 -0500)]
Pass hop index in construct_onion_keys_callback
This simplifies failing route hop calculation, which will be useful for
later identifying the failing hop for PaymentFailed events.
Jeffrey Czyz [Mon, 20 Sep 2021 16:25:39 +0000 (11:25 -0500)]
Remove special case for onion error expiry_too_far
With channel scoring and payment retries, it is no longer necessary to
have expiry_too_far imply a payment failure.
Matt Corallo [Tue, 5 Oct 2021 23:16:20 +0000 (23:16 +0000)]
Merge pull request #1079 from TheBlueMatt/2021-09-stale-docs
Update Event::PaymentReceived docs since we require payment secret
Matt Corallo [Fri, 17 Sep 2021 17:51:13 +0000 (17:51 +0000)]
Update Event::PaymentReceived docs since we require payment secret
Users no longer need to verify the amounts of received payments as
the payment secret will protect us against the probing attacks such
verification was intended to fix.
Matt Corallo [Tue, 5 Oct 2021 19:10:42 +0000 (19:10 +0000)]
Move tests of payment retries into a new module
Matt Corallo [Tue, 5 Oct 2021 18:43:39 +0000 (18:43 +0000)]
Merge pull request #1100 from TheBlueMatt/2021-09-multihop-route-hint-fix
Consider many first-hop paths to the same counterparty in routing
Matt Corallo [Thu, 30 Sep 2021 01:19:04 +0000 (01:19 +0000)]
Merge pull request #1096 from valentinewallace/2021-09-mpp-retries
Valentine Wallace [Tue, 28 Sep 2021 22:31:39 +0000 (18:31 -0400)]
Expire outbound payments after 3 blocks if no parts are pending
Valentine Wallace [Tue, 28 Sep 2021 00:47:32 +0000 (20:47 -0400)]
Don't remove failed payments when all paths fail
This is because we want the ability to retry completely failed
payments.
Upcoming commits will remove these payments on timeout to prevent
DoS issues
Also test that this removal allows retrying single-path payments
Valentine Wallace [Fri, 24 Sep 2021 20:04:47 +0000 (16:04 -0400)]
Add method to retry payments
Matt Corallo [Thu, 30 Sep 2021 00:01:35 +0000 (00:01 +0000)]
Merge pull request #1080 from valentinewallace/2021-09-dup-chan-outpoint
Fix fuzzer-found panic from duplicate channel outpoint
Matt Corallo [Wed, 29 Sep 2021 23:16:22 +0000 (23:16 +0000)]
f readability improvements from val
Matt Corallo [Wed, 29 Sep 2021 20:24:37 +0000 (20:24 +0000)]
Merge pull request #1076 from TheBlueMatt/2021-09-forwardable-regen
Matt Corallo [Wed, 15 Sep 2021 19:20:44 +0000 (19:20 +0000)]
Regenerate PendingHTLCsForwardable on reload instead of serializing
When we are prepared to forward HTLCs, we generate a
PendingHTLCsForwardable event with a time in the future when the
user should tell us to forward. This provides some basic batching
of forward events, improving privacy slightly.
After we generate the event, we expect users to spawn a timer in
the background and let us know when it finishes. However, if the
user shuts down before the timer fires, the user will restart and
have no idea that HTLCs are waiting to be forwarded/received.
To fix this, instead of serializing PendingHTLCsForwardable events
to disk while they're pending (before the user starts the timer),
we simply regenerate them when a ChannelManager is deserialized
with HTLCs pending.
Fixes #1042
Matt Corallo [Wed, 29 Sep 2021 19:15:16 +0000 (19:15 +0000)]
Consider many first-hop paths to the same counterparty in routing
Previously we'd simply overwritten "the" first hop path to each
counterparty when routing, however this results in us ignoring all
channels except the last one in the `ChannelDetails` list per
counterparty.
Matt Corallo [Wed, 29 Sep 2021 18:51:14 +0000 (18:51 +0000)]
Correct step number in `get_route`
Valentine Wallace [Fri, 24 Sep 2021 20:02:11 +0000 (16:02 -0400)]
channelmanager: Add retry data to pending_outbound_payments
Valentine Wallace [Fri, 24 Sep 2021 16:12:16 +0000 (12:12 -0400)]
Refactor send_payment internals for retries 2
Retrying a partial payment means send_payment_internal needs to be parameterized
by a total payment amount, else 'HTLC values do not match' errors
Valentine Wallace [Thu, 23 Sep 2021 20:30:15 +0000 (16:30 -0400)]
Refactor send_payment internals for retries
We want to reuse send_payment internal functions for retries,
so some need to now be parameterized by PaymentId to avoid
generating a new PaymentId on retry
Valentine Wallace [Thu, 23 Sep 2021 20:13:30 +0000 (16:13 -0400)]
Return PaymentId from send_*payment functions
Used in upcoming commits for retries
Valentine Wallace [Thu, 23 Sep 2021 20:06:12 +0000 (16:06 -0400)]
Rename MppId to PaymentId
Leftover from previous PR Jeff feedback.
Useful in upcoming commits as we'll expose this to users for payment retries
Matt Corallo [Mon, 27 Sep 2021 20:39:02 +0000 (20:39 +0000)]
Merge pull request #1065 from TheBlueMatt/2021-08-bump-dust
Increase our default/minimum dust limit and decrease our max
Matt Corallo [Mon, 27 Sep 2021 17:56:21 +0000 (17:56 +0000)]
Rename MIN_DUST_LIMIT_SATOSHIS constant to disambiguate chan vs P2P
While channel and P2P network dust limits are related, they're
ultimately two different things, and thus their constant names
should reference that.
Matt Corallo [Wed, 1 Sep 2021 20:33:49 +0000 (20:33 +0000)]
Force-close channels if closing transactions may be non-standard
If a counterparty (or an old channel of ours) uses a non-segwit
script for their cooperative close payout, they may include an
output which is unbroadcastable due to not meeting the network dust
limit.
Here we check for this condition, force-closing the channel instead
if we find an output in the closing transaction which does not meet
the limit.
Matt Corallo [Wed, 1 Sep 2021 20:22:49 +0000 (20:22 +0000)]
Require user cooperative close payout scripts to be Segwit
There is little reason for users to be paying out to non-Segwit
scripts when closing channels at this point. Given we will soon, in
rare cases, force-close during shutdown when a counterparty closes
to a non-Segwit script, we should also require it of our own users.
Matt Corallo [Wed, 1 Sep 2021 20:18:47 +0000 (20:18 +0000)]
Reduce the maximum allowed counterparty dust limit to 546 sat/vbyte
546 sat/vbyte is the current default dust limit on most
implementations, matching the network dust limit for P2SH outputs.
Implementations don't currently appear to send any larger dust
limits, and allowing a larger dust limit implies higher payment
failure risk, so we'd like to be as tight as we can here.
Matt Corallo [Mon, 27 Sep 2021 18:19:19 +0000 (18:19 +0000)]
Merge pull request #1097 from TheBlueMatt/2021-09-clonable-netgraph
Make `NetworkGraph` Clone-able again
Matt Corallo [Sun, 26 Sep 2021 04:20:44 +0000 (04:20 +0000)]
Make `NetworkGraph` Clone-able again
There isn't a lot of user-utility for cloning `NetworkGraph`
directly (its a rather large struct, and there probably isn't a lot
of reason to have *multiple* `NetworkGraph`s). Thus, when locks
were pushed down into it, the `Clone`-ability of it was dropped as
well.
Sadly, mapping the Java memory model onto:
* `Read`-ing a `NetworkGraph`, creating a Java-owned
`NetworkGraph` object that the JVM will destruct for us,
* Passing it to a `NetGraphMsgHandler`, which now expects to own
the `NetworkGraph`, including destructing it,
isn't really practical without adding a clone in between.
Given this, and the fact that there's nothing inherently wrong with
clone-ing a `NetworkGraph`, we simply re-add `Clone` here.
Matt Corallo [Thu, 23 Sep 2021 18:43:25 +0000 (18:43 +0000)]
Merge pull request #1095 from TheBlueMatt/2021-09-0.0.101
Bump Crate versions to 0.0.101 (and invoice to 0.9)
Matt Corallo [Thu, 23 Sep 2021 18:22:29 +0000 (18:22 +0000)]
Bump Crate versions to 0.0.101 (and invoice to 0.9)
Matt Corallo [Thu, 23 Sep 2021 18:12:02 +0000 (18:12 +0000)]
Merge pull request #1085 from TheBlueMatt/2021-09-0.0.101
Cut 0.0.101
Matt Corallo [Mon, 20 Sep 2021 22:07:03 +0000 (22:07 +0000)]
Update CHANGELOG for 0.0.101