Commit Graph
100 Commits
Author SHA1 Message Date
yyforyongyu 1d53e7d081 multi: improve loggings 2024-12-20 17:54:03 +08:00
yyforyongyu 7545bbfa92 sweep: make sure defaultDeadline is derived from the mature height 2024-12-20 17:54:00 +08:00
yyforyongyu afc08c6623 sweep: add method isMature on SweeperInput
Also updated `handlePendingSweepsReq` to skip immature inputs so the
returned results are the same as those in pre-0.18.0.
2024-12-20 17:53:59 +08:00
yyforyongyu ba238962d6 sweep: add method handleBumpEventError and fix markInputFailed
Previously in `markInputFailed`, we'd remove all inputs under the same
group via `removeExclusiveGroup`. This is wrong as when the current
sweep fails for this input, it shouldn't affect other inputs.
2024-12-20 17:53:59 +08:00
yyforyongyu 719ca5b229 sweep: remove redundant error from Broadcast 2024-12-20 17:53:59 +08:00
yyforyongyu 6c2e8b9a00 sweep: add new state TxFatal for erroneous sweepings
Also updated the loggings. This new state will be used in the following
commit.
2024-12-20 17:53:58 +08:00
yyforyongyu 188aa9a4d4 routing+lnd: prepare closed channel SCIDs in server
The method `FetchClosedChannels` sometimes prematurely mark a pending
force closing channel as finalized, therefore we need to furthur check
`FetchPendingChannels` to make sure the channel is indeed finalized.
2024-08-07 22:19:23 +08:00
yyforyongyu e8f292edf4 docs: update release notes re stuck payment fix 2024-08-07 22:19:22 +08:00
yyforyongyu c2f7e6a66f routing: fail stale HTLC attempts during startup
This commit adds a check during router's startup and fails the inflight
HTLCs if they are routing using channels unknown to us. The channels are
unknown because they are already closed, usually long time ago.
2024-08-07 22:19:21 +08:00
yyforyongyu b998ce11f1 routing+htlcswitch: add new interface method HasAttemptResult 2024-08-07 22:18:51 +08:00
yyforyongyu bbf58ab444 routing: add new method resumePayments to handle payments during
startup
2024-08-07 22:18:49 +08:00
yyforyongyu 3b6e28d19b channeldb+htlcswitch: make sure circuit is not nil in teardownCircuit 2024-08-07 22:17:59 +08:00
yyforyongyu 2fc79d8946 htlcswitch: handle forwarding settle and fail seperately
This commit adds two methods, `handlePacketFail` and
`handlePacketSettle` to handle the settle and fail packets differently.
2024-08-07 22:17:59 +08:00
yyforyongyu 6cb374aea6 htlcswitch: add new method handlePacketAdd
Simply moves the code into a new method so it's easier to follow the
method `handlePacketForward`.
2024-08-07 22:17:59 +08:00
yyforyongyu d28d5d7a47 itest: add testSendToRouteFailHTLCTimeout to check SendToRouteV2 2024-08-07 22:17:58 +08:00
yyforyongyu 21112cfdf8 htlcswitch: rename paymentID to attemptID for clarity 2024-08-07 22:17:58 +08:00
yyforyongyu 941716d60e lntest+itest: add new test testPaymentHTLCTimeout
This commit adds a new test case to validate that when an HTLC has timed
out, the corresponding payment is marked as failed.
2024-08-07 22:17:58 +08:00
yyforyongyu 0928ba0149 routing: fix and enhance logging 2024-08-07 22:17:58 +08:00
yyforyongyu 8240a87c2b itest: fix misuse of MineBlocks and replace it with
`MineBlocksAndAssertNumTxes`
2024-07-23 21:30:08 +08:00
yyforyongyu f1f341095e lntest+itest: add new method CurrentHeight 2024-07-23 21:30:08 +08:00
yyforyongyu 14e7b134d9 lntest+itest: make Miner a private instance 2024-07-23 21:30:08 +08:00
yyforyongyu be4dba5da6 lntest+itest: finalize moving miner methods 2024-07-23 21:30:07 +08:00
yyforyongyu 6bd8baea38 lntest+itest: continue removing direct call to Miner 2024-07-23 21:30:07 +08:00
yyforyongyu 976bb37972 lntest+itest: add method AssertNumTxsInMempool and AssertTxInBlock
in harness

Prepare to make `HarnessTest.Miner` a private instance to sync height.
2024-07-23 21:30:07 +08:00
yyforyongyu e553895ddd lntest+itest: strictly define the behavior of MineBlocks
This commit adds more assertion to `MineBlocks` so the caller won't
misuse it.
2024-07-23 21:30:07 +08:00
yyforyongyu 91b20e661b lntest: move mining methods into one file 2024-07-23 21:30:07 +08:00
yyforyongyu a881477404 lntest: create new package lntest/miner for itest miner
This commit moves the `HarnessMiner` into a new package to avoid
confusion about incoming changes.
2024-07-23 21:30:07 +08:00
yyforyongyu d9498a9d13 lntest: increase DefaultTimeout for postgres 2024-06-04 09:07:44 +02:00
yyforyongyu c9cad6ab81 itest+sweep: refactor testSignPsbt to use Subtest and add logs 2024-06-04 09:07:44 +02:00
yyforyongyu 55452f64e8 lntest: wait for mempool update after mining txns 2024-06-04 09:07:43 +02:00
yyforyongyu 2e40a23146 lnrpc: fix linter 2024-05-25 13:37:16 +08:00
yyforyongyu 5e8452cc5d sweep: make sure the full input is accounted
Fix the case where previously only the witness data is taken into
account when calculating the fees.
2024-05-25 13:37:16 +08:00
yyforyongyu 17a089c899 input+lnwallet: apply the new type lntypes.VByte 2024-05-25 13:37:16 +08:00
yyforyongyu 8da68bb7db multi: apply the new type lntypes.WeightUnit 2024-05-25 13:37:13 +08:00
yyforyongyu dc9a0b31c0 lntypes: add new units WeightUnit and VByte 2024-05-24 23:56:28 +08:00
yyforyongyu 634967c5c8 chainfee: add FeeForVByte on SatPerKWeight 2024-05-24 22:49:20 +08:00
yyforyongyu 347537791e sweep: improve loggings based on feedback
This commit changes the logging levels and add a few more loggings based
on the testing results from the testnet/mainnet.
2024-05-21 00:53:24 +08:00
yyforyongyu e45db07a10 contractcourt+itest: make sure ChannelArbitrator has the latest htlcs 2024-05-21 00:53:23 +08:00
yyforyongyu 71ee50f87c lncli: add missing SatPerVbyte field in bumpfee cli 2024-05-21 00:53:23 +08:00
yyforyongyu 4079f61d7e itest+sweep: fix current itest re anchor deadline 2024-05-21 00:53:20 +08:00
yyforyongyu e68c0235c6 itest: add new itests to check CPFP anchor sweeping behavior
Replaced `testSweepAnchorCPFPLocalForceClose` with dedicated tests.
2024-05-18 07:45:10 +08:00
yyforyongyu 38184e88c8 sweep: check all states in TestMarkInputsPublishFailed 2024-05-18 07:45:09 +08:00
yyforyongyu ac5af48319 sweep: make sure the budget is used up at deadlineHeight-1 2024-05-18 07:45:09 +08:00
yyforyongyu 1470adbed2 contractcourt: share deadlines between CPFP anchors and HTLCs
This commit changes how the deadline is calculated for CPFP anchor
sweeping. In order to sweep the second-level HTLCs, we need to first
get the FC tx confirmed. If we use a larger conf target for CPFP, we'd
end up having few blocks to sweep the HTLCs, as these two sweeping txns
share the deadline of the HTLC, as shown below,
```
More aggressive on the CPFP part.
|-CPFP-|-----HTLC-----|

Share the deadlines evenly.
|---CPFP---|---HTLC---|

More aggressive on the HTLC part.
|-----CPFP-----|-HTLC-|
```
In this commit, we decide to share the deadlines evenly as a starting
point so neither side will have a short of deadlines.
2024-05-18 07:45:09 +08:00
yyforyongyu 2906b8b20c sweep: update and fix README 2024-05-18 07:45:09 +08:00
yyforyongyu 187b0b1f80 cli: add --amp to SendPaymentRequest in payinvoice 2024-05-06 16:01:35 +08:00
yyforyongyu 6bbbfd3327 docs: add missing fee section sample-lnd.conf 2024-05-04 14:41:41 +08:00
yyforyongyu 3f8da16b77 sweep: make TxPublisher.currentHeight atomic 2024-05-01 12:16:54 +08:00
yyforyongyu 9f2995251e lnrpc: fix typo 2024-04-29 19:14:27 +08:00
yyforyongyu db52e7e381 docs: update release notes 2024-04-26 10:42:46 +08:00
yyforyongyu d0441a2a29 multi: add default conf targt in SendCoins/SendMany/OpenChannel/CloseChannel 2024-04-26 10:42:44 +08:00
yyforyongyu e855421095 docs: update release notes 2024-04-23 23:19:41 +08:00
yyforyongyu 83024585bb sweep: add README 2024-04-23 23:17:44 +08:00
yyforyongyu 9c5124e117 sweep: remove unused param Fee 2024-04-23 04:44:00 +08:00
yyforyongyu 54aaeea491 sweep: remove dead code and dead tests 2024-04-23 04:44:00 +08:00
yyforyongyu 4d96f9c4c1 docs: add release notes 2024-04-20 04:41:31 +08:00
yyforyongyu d854c80aa7 itest+lntest: fix itest re the new sweeping behavior 2024-04-20 04:41:29 +08:00
yyforyongyu e0f0f5c6a9 sweep: skip wallet inputs in isThirdPartySpent 2024-04-19 21:33:40 +08:00
yyforyongyu a50cdd64c5 sweep: assign deadline values to inputs in handleNewInput
This commit changes how we transform from a deadline option to a
concrete deadline value - previously this is done when we decide to
cluster inputs, and we now move it to a step earlier - once an input is
received via `SweeperInput`, we will immediately transform its optional
deadline into a real value. For inputs that come with a deadline option,
since the Some will be used, it makes no difference. For inputs with
None as their deadlines, we need this change to make sure the default
deadlines are assigned accurately.
2024-04-19 21:33:39 +08:00
yyforyongyu 96883f307c itest+sweep: add itest testSweepCommitOutputAndAnchor
This commit adds a test case to check the no deadline sweeping behavior.
The sweeper is updated to make sure it can handle the case for neutrino
backend.
2024-04-19 21:33:39 +08:00
yyforyongyu f5a321d0d3 contractcourt: remove unused param to please linter 2024-04-19 21:33:39 +08:00
yyforyongyu 871cab4bc0 sweep: make sure inputs with different locktime values are not grouped 2024-04-19 21:33:39 +08:00
yyforyongyu 49cfb91af1 contractcourt: make sure sweep happens immediately on startup
This commit makes sure the time-sensitive outputs are swept immediately
during startup.
2024-04-19 21:33:39 +08:00
yyforyongyu 7abefa7760 cmd: update bumpfee, bumpclosefee and bumpforceclosefee 2024-04-19 21:33:38 +08:00
yyforyongyu 6f55a7af05 itest: add new test to check BumpFee and PendingSweeps 2024-04-19 21:33:38 +08:00
yyforyongyu 11a276e222 walletrpc+sweep: update PendingSweeps to return the new params 2024-04-19 21:33:38 +08:00
yyforyongyu 8804947179 walletrpc+sweep: refactor BumpFee to properly handle sweep request 2024-04-19 21:33:38 +08:00
yyforyongyu 94159e8950 walletrpc: update walletkit.proto to use the new sweep params 2024-04-19 21:33:38 +08:00
yyforyongyu 9be5b370a7 sweep+contractcourt: replace ParamsUpdate with Params 2024-04-19 21:33:38 +08:00
yyforyongyu b6a2984167 sweep: allow specifying starting fee rate for fee func 2024-04-19 21:33:37 +08:00
yyforyongyu db3aad31aa lnrpc+sweep: rename Force to Immediate for clarity 2024-04-19 21:33:37 +08:00
yyforyongyu 19a599a1a9 sweep: catch third party spent in fee bumper for neutrino
This commit adds a new check for neutrino backend - when the inputs in
the sweeping tx are spent by a third party, we will send back a
`TxFailed` event to free the rest of the inputs for re-grouping.
2024-04-19 21:33:37 +08:00
yyforyongyu 563a5caed5 itest: fix watchtower test 2024-04-19 21:33:37 +08:00
yyforyongyu d4de6dd236 itest+lntest: fix onchain tests 2024-04-19 21:33:37 +08:00
yyforyongyu 9c34eb7a56 itest: fix revocation itest 2024-04-19 21:33:37 +08:00
yyforyongyu 30c2b9f2df itest: fix channel backup tests 2024-04-19 21:33:36 +08:00
yyforyongyu f68c14321b itest: fix multi-hop itest 2024-04-19 21:33:36 +08:00
yyforyongyu ce58175314 itest+lntest: fix channel force close itest 2024-04-19 21:33:36 +08:00
yyforyongyu 6933c5a86c itest: remove old CPFP tests
The old commitment deadline is removed as it's no longer relevant.
2024-04-19 21:33:36 +08:00
yyforyongyu a1a480a81c itest+lntest: add itest testSweepHTLCs to check HTLC sweepings 2024-04-19 21:33:36 +08:00
yyforyongyu 94e0e32c74 multi: add itest testSweepAnchorCPFPLocalForceClose
This commit adds an itest case that focuses on validating the CPFP logic
in anchor sweeping.
2024-04-19 21:33:36 +08:00
yyforyongyu a2b8f4e19c sweep: allow published input to be marked as PublishFailed
If anything happens during the fee bumping process, and causes the input
to be failed, we should be able to mark it as `PublishFailed`.
2024-04-19 21:33:35 +08:00
yyforyongyu acde08c65a contractcourt: offer second-level outputs at CSV-1
This commit moves the offering of second-level outputs one block
earlier. The sweeper will check the required locktime and wait until it
matures. This is needed so the second-level outputs can be aggregated
properly.
2024-04-19 21:33:35 +08:00
yyforyongyu c644deb49f contractcourt: add locks in SubscribeChannelEvents 2024-04-19 21:33:35 +08:00
yyforyongyu 07466c4f8c multi: query circuit map inside contractcourt
This commit adds a new config method `QueryIncomingCircuit` that can be
used to query the payment's incoming circuit for giving its outgoing
circuit key.
2024-04-19 21:33:35 +08:00
yyforyongyu 4134b1c00a sweep: make sure max fee rate can be reached
Previously we don't allow confTarget to be 0, which ended up the final
position being never reached. We fix it here by allowing confTarget to
be 0 in case the deadline has already been passed for a given input.
2024-04-19 21:33:35 +08:00
yyforyongyu dc7d90c16f contractcourt+sweep: offer direct-preimage spend via SweepInput
This commit removes the method `CreateSweepTx` and makes sure when
sweeping the htlc output via the direct-preimage spend, it's offered via
the `SweepInput` interface.
2024-04-19 21:33:35 +08:00
yyforyongyu 9c1e6941c3 contractcourt: specify deadline and budget for nursery 2024-04-19 21:33:34 +08:00
yyforyongyu 33abbe1942 contractcourt+lnd: make IncubateOutputs take fn.Option
`IncubateOutputs` never takes more than one HTLC, so we change the
params to be optional, which helps with the following commit where we
pass the deadline height when incubating outgoing HTLCs.
2024-04-19 21:33:34 +08:00
yyforyongyu 6f0c2b5bab contractcourt: specify deadline and budget for anchor output 2024-04-19 21:33:34 +08:00
yyforyongyu f4035ade05 contractcourt: calculate value left when searching for commit deadline
This commit changes `findCommitmentDeadline` to
`findCommitmentDeadlineAndValue` to calculate the value left from all
the time-sensitive HTLCs after subtracting their budgets. This value is
then used to calculate the budget to be used when sweeping the anchor
output.
2024-04-19 21:33:34 +08:00
yyforyongyu cab180a52e contractcourt: specify deadline and budget for htlc timeout 2024-04-19 21:33:34 +08:00
yyforyongyu d1ad07fa21 contractcourt+lnwallet: specify deadline and budget for htlc success 2024-04-19 21:33:33 +08:00
yyforyongyu 01fd4e5642 contractcourt: specify deadline and budget for commit sweep 2024-04-19 21:33:33 +08:00
yyforyongyu aa44197f88 contractcourt: init BudgetConfig in unit tests 2024-04-19 21:33:33 +08:00
yyforyongyu 0a611aae00 multi: add new config option BudgetConfig and NoDeadlineConfTarget
This commit adds a new group config `BudgetConfig` to allow users
specifying their own preference when sweeping outputs. And a new config
option `NoDeadlineConfTarget` is added in case the user wants to use a
different "lazy" conf target.
2024-04-19 21:33:33 +08:00
yyforyongyu c44b8a4b45 lnd: start using BudgetAggregator 2024-04-19 21:33:33 +08:00
yyforyongyu 54ade99ce2 sweep: apply fn.NewSet and fn.Map in validateInputs 2024-04-19 21:33:33 +08:00
yyforyongyu 4c13ea1747 sweep: pass default deadline height when clustering inputs
This commit changes the method `ClusterInputs` to also take a default
deadline height. Previously, when calculating the default deadline
height for a non-time sensitive input, we would first cluster it with
other non-time sensitive inputs, then give it a deadline before we are
about to `sweep`. This is now moved to the step where we decide to
cluster inputs, allowing time-sensitive and non-sensitive inputs to be
grouped together, if they happen to share the same deadline heights.
2024-04-19 21:33:32 +08:00
yyforyongyu 15588355b3 sweep: exit when handleNewInput fails
When `handleNewInput` fails, it means there's something terribly wrong
with the chain backend, which means we need to stop the current process
and let user handle it.
2024-04-19 21:33:32 +08:00