Commit Graph

301 Commits

Author SHA1 Message Date
yyforyongyu
4806b2fda7
multi: optimize loggings around changes from blockbeat 2024-12-20 17:54:08 +08:00
yyforyongyu
1d53e7d081
multi: improve loggings 2024-12-20 17:54:03 +08:00
yyforyongyu
545cea0546
multi: start consumers with a starting blockbeat
This is needed so the consumers have an initial state about the current
block.
2024-12-20 17:54:02 +08:00
yyforyongyu
3ac6752a77
sweep: remove redundant notifications during shutdown
This commit removes the hack introduced in #4851. Previously we had this
issue because the chain notifier was stopped before the sweeper, which
was changed a while back and we now always stop the chain notifier last.
In addition, since we no longer subscribe to the block epoch chan
directly, this issue can no longer happen.
2024-12-20 17:54:01 +08:00
yyforyongyu
e113f39d26
sweep: remove block subscription in UtxoSweeper and TxPublisher
This commit removes the independent block subscriptions in `UtxoSweeper`
and `TxPublisher`. These subsystems now listen to the `BlockbeatChan`
for new blocks.
2024-12-20 17:54:01 +08:00
yyforyongyu
801fd6b85b
multi: implement Consumer on subsystems
This commit implements `Consumer` on `TxPublisher`, `UtxoSweeper`,
`ChainArbitrator` and `ChannelArbitrator`.
2024-12-20 17:54:01 +08:00
yyforyongyu
30ee450091
sweep: make sure nil tx is handled
After previous commit, it should be clear that the tx may be failed to
created in a `TxFailed` event. We now make sure to catch it to avoid
panic.
2024-12-20 17:54:00 +08:00
yyforyongyu
78ce757e7b
sweep: break initialBroadcast into two steps
With the combination of the following commit we can have a more granular
control over the bump result when handling it in the sweeper.
2024-12-20 17:54:00 +08:00
yyforyongyu
f0c4e6dba1
sweep: remove redundant loopvar assign 2024-12-20 17:54:00 +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
77ff2c0585
sweep: add handleInitialBroadcast to handle initial broadcast
This commit adds a new method `handleInitialBroadcast` to handle the
initial broadcast. Previously we'd broadcast immediately inside
`Broadcast`, which soon will not work after the `blockbeat` is
implemented as the action to publish is now always triggered by a new
block. Meanwhile, we still keep the option to bypass the block trigger
so users can broadcast immediately by setting `Immediate` to true.
2024-12-20 17:53:59 +08:00
yyforyongyu
2479dc7f2e
sweep: handle inputs locally instead of relying on the tx
This commit changes how inputs are handled upon receiving a bump result.
Previously the inputs are taken from the `BumpResult.Tx`, which is now
instead being handled locally as we will remember the input set when
sending the bump request, and handle this input set when a result is
received.
2024-12-20 17:53:59 +08:00
yyforyongyu
d0c7fd8aac
sweep: add new interface method Immediate
This prepares the following commit where we now let the fee bumpr
decides whether to broadcast immediately or not.
2024-12-20 17:53:59 +08:00
yyforyongyu
5f64280df4
sweep: add new error ErrZeroFeeRateDelta 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
Keagan McClelland
ed2989ae33
multi: update to fn v2 2024-12-04 13:19:00 -07:00
Elle Mouton
ab7aae0708
multi: rename nolint:lll to nolint:ll
Find and replace all nolint instances refering to the `lll` linter and
replace with `ll` which is the name of our custom version of the `lll`
linter which can be used to ignore log lines during linting.

The next commit will do the configuration of the custom linter and
disable the default one.
2024-12-02 09:14:21 +02:00
chuangjinglu
bcfd8d5b47 multi: fix some function names in interface comment
Signed-off-by: chuangjinglu <chuangjinglu@outlook.com>
2024-11-25 10:49:00 +08:00
Olaoluwa Osuntokun
7ed2c10671
sweep: update storeRecord to include utxo index
In this commit, we complete a recently added feature by ensuring that
even if we go through the RBF loop to create a txn, that we still
populate the `outpointToIndex` map. Unit tests have been updated to
ensure this is always set as expected.
2024-11-18 18:12:41 -08:00
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