Commit Graph

279 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
414894348a
sweep: update BudgetInputSet.Budget() to factor in extra budget
In this commit, we update the `Budget()` call to factor in the
`extraBudget` value. Otherwise, when we go to intialize the fee
function, we won't factor in the extra budget, and will determine that
we can't broadcast/bump.
2024-11-14 16:09:59 -08:00
Olaoluwa Osuntokun
ba16a74491
sweep: expand NotifyBroadcast to include an outpoint index
In this commit, we expand the `NotifyBroadcast` to include an outpoint
index. This is useful as it indicates the index of a given required tx
out input.
2024-11-14 16:09:58 -08:00
Elle Mouton
23602e017e
multi: start updating various loggers to use the new v2 type 2024-10-22 17:03:55 +02:00
Olaoluwa Osuntokun
bdaa9f4146
sweep: ensure we factor in extra change addrs in MaxFeeRateAllowed 2024-10-02 18:10:14 -07:00
Olaoluwa Osuntokun
eaea11e48f
sweep: update sweeper to use AuxSweeper to add extra change addr
In this commit, we start to use the AuxSweeper (if present) to obtain a
new extra change addr we should add to the sweeping transaction. With
this, we'll take the set of inputs and our change addr, and then maybe
gain a new change addr to add to the sweep transaction.

The extra change addr will be treated as an extra required tx out,
shared across all the relevant inputs. This'll also be used in
NeedWalletInput to make sure that we add an extra input if needed to be
able to pay for the change addr.
2024-10-02 18:09:58 -07:00
Olaoluwa Osuntokun
cb93f8c01a
sweep: add new AuxSweeper interface
In this commit, we add a new AuxSweeper interface. This'll take a set of
inputs, and a change addr for the sweep transaction, then optionally
return a new sweep output to be added to the sweep transaction.

We also add a new NotifyBroadcast method.  This'll be used to notify
that we're _about_ to broadcast a sweeping transaction. The set of
inputs is passed in, which allows the caller to prepare for the ultimate
broadcast of the sweeping transaction.

We also add ExtraTxOut to BumpRequest pass fees to NotifyBroadcast. This
allows the callee to know the total fee of the sweeping transaction.
2024-10-02 18:09:57 -07:00
Olaoluwa Osuntokun
d52d30d46e
server+sweep: convert GenSweepScript to use new addr type
We convert it to use lnwallet.AddrWithKey, as in the future, knowing the
internal key for an address will be useful.
2024-10-02 18:09:56 -07:00
Olaoluwa Osuntokun
e0ced8e629
lnwallet+peer: move internalKeyForAddr to lnwallet package
This way we can re-use it. We also make it slightly more generalized.
2024-10-02 18:09:52 -07:00
Olaoluwa Osuntokun
cc9e2b783e
Merge pull request #8961 from yyforyongyu/fix-leaseoutput
Improve the performace of `LeaseOutput`
2024-08-21 16:31:26 -07:00
ziggie
22b504db7c
sweep: add TODO to the sweeper behavior.
Make sure we only trigger the sweep of a specific input when
updating its fee parameters not the all the current pending
registered sweeps.
2024-08-09 19:41:27 +02:00
yyforyongyu
3e36adf476
mulit: remove ListLeasedOutputs in LeaseOutput
This commit removes the call toe `ListLeasedOutputs` in `LeaseOutput` -
the returned info from `ListLeasedOutputs` can easily be accessed via
`FetchInputInfo` and this info is only used at one callsite.
`ListLeasedOutputs` then becomes unnecessary here, plus it's very slow
and needs to be refactored in `btcwallet` instead.
2024-08-09 22:01:57 +08:00
Ononiwu Maureen
13bad2c20c
sweep: Add selectUtxos to CraftSweepAllTx args 2024-08-07 20:42:28 +08:00
ziggie
653e2f3667
multi: Allow interrupt of server startup.
This commit does two things. It starts up the server in a way that
it can be interrupted and shutdown gracefully.
Moreover it makes sure that subsystems clean themselves up when
they fail to start. This makes sure that depending subsytems can
shutdown gracefully as well and the shutdown process is not stuck.
2024-07-31 13:12:19 +02:00
ziggie
08b68bbaf7
multi: Add atomic start/stop functions.
Make sure that each subsystem only starts and stop once. This makes
sure we don't close e.g. quit channels twice.
2024-07-31 13:12:19 +02:00
yyforyongyu
d992cf94d6
multi: add SpewLogClosure to avoid code repetition 2024-07-25 22:18:49 +08:00
yyforyongyu
b6049ff94b
multi: add NewLogClosure in lnutils to avoid repetition
And replaces all usage of `logClosure` with `lnutils.LogClosure`.
2024-07-25 21:25:23 +08:00
Oliver Gugger
578e1d4965
Merge pull request #8881 from mwaite-codes/fix-doc-grammar
Fix various typos in docs for readability
2024-07-23 00:25:17 -06:00
Marcia Waite
e6dca0ce6e multi: Fix typos and grammar in multiple docs 2024-07-22 20:08:12 -07:00
yyforyongyu
ddf46f435c
multi: update RPC error import path
These errors are now defined in `btcwallet/chain` instead of
`btcd/rpcclient`.
2024-07-06 13:59:28 +08:00
yyforyongyu
c9cad6ab81
itest+sweep: refactor testSignPsbt to use Subtest and add logs 2024-06-04 09:07:44 +02: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
8da68bb7db
multi: apply the new type lntypes.WeightUnit 2024-05-25 13:37:13 +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
4079f61d7e
itest+sweep: fix current itest re anchor deadline 2024-05-21 00:53:20 +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
2906b8b20c
sweep: update and fix README 2024-05-18 07:45:09 +08:00
yyforyongyu
3f8da16b77
sweep: make TxPublisher.currentHeight atomic 2024-05-01 12:16:54 +08:00
yyforyongyu
d0441a2a29
multi: add default conf targt in SendCoins/SendMany/OpenChannel/CloseChannel 2024-04-26 10:42:44 +08:00
ziggie
62a52b4d7c
multi: Utxo restriction single funding case.
Restrict the utxo selection when opening a single internal wallet
funded backed channel.
2024-04-24 13:58:19 +01: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
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
871cab4bc0
sweep: make sure inputs with different locktime values are not grouped 2024-04-19 21:33:39 +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
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
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
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
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
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