Commit Graph

16515 Commits

Author SHA1 Message Date
yyforyongyu
124d1764f7 sweep: remove unused param testSpendChan 2024-04-19 21:33:23 +08:00
yyforyongyu
fd922942a7 sweep: patch unit tests for markInputsSwept and markInputsPendingPublish
Now that the refactor is done, we start patching unit tests for these
two methods. Minor changes are also made based on the feedback from the
tests.
2024-04-19 21:33:23 +08:00
yyforyongyu
34b6a3d718 sweep: add method markInputFailed 2024-04-19 21:33:23 +08:00
yyforyongyu
a8f5a09dea sweep: don't give up an input based on number of attempts
This commit removes the logic where we remove an input when it's been
published more than 10 times. This is needed as in our future fee
bumper, we might start with a low fee and rebroadcast the same input for
hundred of blocks.
2024-04-19 21:33:23 +08:00
yyforyongyu
8b876be3b6 sweep: add fee info for published inputs
This commit attaches RBFInfo to an input before it's been published or
it's already been published.
2024-04-19 21:33:22 +08:00
yyforyongyu
a263d68fb9 sweep: delete pending inputs based on their states
This commit uniforms and put the deletion of pending inputs in a single
point.
2024-04-19 21:33:22 +08:00
yyforyongyu
47478718d4 multi: query mempool spend when a new input is received
This commit changes how a new input sweep request is handled - now we
will query the mempool and see if it's already been spent. If so, we'll
update its state as we may need to RBF this input.
2024-04-19 21:33:22 +08:00
yyforyongyu
6a2e3fb203 sweep: make pending input stateful
This commit starts tracking the state of a pending input so it's easier
to control the sweeping flow and provide RBF awareness in the future.
2024-04-19 21:33:22 +08:00
yyforyongyu
1e6e443a0b docs: update release notes 2024-04-19 21:33:22 +08:00
yyforyongyu
61e9c11881 rpcserver: skip calculating fee rate for PSBT funding 2024-04-19 21:33:22 +08:00
yyforyongyu
519a8749ef lntest: reflect the updated fee estimator in tests 2024-04-19 21:33:21 +08:00
yyforyongyu
1870caf39c sweep+lnd: introduce UtxoAggregator to handle clustering inputs
This commit refactors the grouping logic into a new interface
`UtxoAggregator`, which makes it easier to write tests and opens
possibility for future customized clustering strategies.

The old clustering logic is kept as and moved into `SimpleAggregator`.
2024-04-19 21:33:21 +08:00
yyforyongyu
3bcac318eb sweep+lnrpc: add new interface FeePreference
This commit adds a new interface `FeePreference` which makes it easier
to write unit tests and allows more customized implementation in
following commits.
2024-04-19 21:33:21 +08:00
yyforyongyu
530eed92a0 multi: rename FeePreference to FeeEstimateInfo
Results from running,
```
gofmt -d -w -r 'FeePreference -> FeeEstimateInfo' .
```
2024-04-19 21:33:21 +08:00
yyforyongyu
6ff6c86155 multi: merge DetermineFeePerKw and Estimate
This commit moves `DetermineFeePerKw` into the `Estimate` method on
`FeePreference`. A few callsites previously calling `DetermineFeePerKw`
without the max fee rate is now also temporarily fixed by forcing them
to use `Estimate` with the default sweeper max fee rate.
2024-04-19 21:33:21 +08:00
yyforyongyu
18b06b7303 sweep: replace feeRateForPreference with Estimate
This commit refactors the sweeper so the method `feeRateForPreference`
is now moved to `FeePreference`, which makes our following refactor
easier to handle.
2024-04-19 21:33:20 +08:00
yyforyongyu
84a6fdcda3 sweep+contractcourt: track best height in UtxoSweeper
Thus we can use shorter method signatures. In doing so we also remove an
old TODO in one use case of `CreateSweepTx`.
2024-04-19 21:33:20 +08:00
yyforyongyu
ca0813b1bf docs: update release docs 2024-04-19 21:33:20 +08:00
yyforyongyu
f13a3a8053 sweep: use testify/mock for MockSweeperStore 2024-04-19 21:33:20 +08:00
yyforyongyu
8b9d5e0548 sweep: add new methods GetTx and DeleteTx to manage TxRecord 2024-04-19 21:33:20 +08:00
yyforyongyu
b37444d0de sweep: expand sweeper store to also save RBF-related info
This commit modifies the sweeper store to save a `TxRecord` in db
instead of an empty byte slice. This record will later be used to bring
RBF-awareness to our sweeper.
2024-04-19 21:33:20 +08:00
yyforyongyu
1ace1fdf4c sweep: return fees from method createSweepTx
Which will be used to make the sweeper RBF-aware.
2024-04-19 21:33:19 +08:00
yyforyongyu
e86843da6e sweep: rename NotifyPublishTx to StoreTx
To properly reflect what the method really does. We also changes the
method signature so only a hash is used.
2024-04-19 21:33:19 +08:00
Olaoluwa Osuntokun
d4c1937572 Merge pull request #8573 from guggero/bitcoind-27
GitHub: use bitcoind v27.0 for CI
2024-04-18 14:36:58 -07:00
Olaoluwa Osuntokun
63ef2f8433 Merge pull request #8643 from Roasbeef/kvdb-top-level-module-bump
build: bump top level module to kvdb v1.4.6
2024-04-18 14:22:08 -07:00
Keagan McClelland
6257df31e0 tlv: add axiomatic RecordProducer implementation for Record
This commit introduces a RecordProducer implementation for Record
that serves as the identity function. This makes it easier for us
to mix Primitive and Dynamic records in the same RecordProducer
collections.
2024-04-18 12:03:27 -06:00
Oliver Gugger
a42fc24220 docs: add release notes 2024-04-18 18:13:02 +02:00
Oliver Gugger
f41d6087d1 mod: bump btcd to fix sendrawtransaction max fee issue 2024-04-18 17:44:04 +02:00
Oliver Gugger
817ddb807b GitHub+scripts: use bitcoind v27.0 2024-04-18 17:44:04 +02:00
Oliver Gugger
2ccf58e2af Merge pull request #8630 from guggero/addr-master-fingerprint
mod: bump btcwallet to latest version
2024-04-16 07:00:13 +00:00
Olaoluwa Osuntokun
2162c943de build: bump top level module to kvdb v1.4.6 2024-04-12 15:32:22 -07:00
Olaoluwa Osuntokun
07b6af41db Merge pull request #8642 from Roasbeef/kvdb-update
kvdb: bump to sqldb/v1.0.1
kvdb/v1.4.6
2024-04-12 15:29:28 -07:00
Olaoluwa Osuntokun
06e4ffb3f3 kvdb: bump to sqldb/v1.0.1
Post merge module clean up after
https://github.com/lightningnetwork/lnd/pull/8611.
2024-04-12 15:16:26 -07:00
Oliver Gugger
f35ce0981d docs: update release notes 2024-04-12 08:34:56 +02:00
Oliver Gugger
333fc6eb1d mod: bump btcwallet to latest version
Fixes #8626.
This commit updates btcwallet to the latest version that correctly
includes the MasterKeyFingerprint for all generated addresses, including
change addresses derived from imported watch-only accounts.
2024-04-12 08:34:54 +02:00
Olaoluwa Osuntokun
1c229e4422 Merge pull request #8611 from bhandras/sql-tx-retry
sqldb+kvdb: unify SQL error mapping and transaction retry for between the `kvdb` and `sqldb` packages
sqldb/v1.0.1
2024-04-11 15:41:56 -07:00
Andras Banki-Horvath
024598266d docs: update release notes for 0.18 2024-04-11 15:04:04 +02:00
Andras Banki-Horvath
043e4aff01 sqldb+invoices: fix ordering bug in FilterInvoices
Previously if the `reverse` named arg was unset (value of NULL), then
SQL would order by NULL instead of ID causing undifined ordering of the
returned rows. To fix that we check for NULL and also make sure to set
the `reverse` arg in the code explicitly as it in the generated code it
is an `interface{}` instead of `bool`.
2024-04-11 15:04:04 +02:00
Andras Banki-Horvath
478ae1e9b0 sqldb: cleanup scope state reset by adding reset closure to ExecTx
For SQL transactions, we often accumulate results in variables declared
outside the closure's scope. To eliminate the need for manually clearing
these containers, we introduce a reset function to ExecTx, mirroring the
approach already adopted in kvdb.
2024-04-11 15:04:04 +02:00
Andras Banki-Horvath
c6073a14ca sqldb: ensure that we're using serializable isolation 2024-04-11 15:04:04 +02:00
Olaoluwa Osuntokun
0609431a0c channeldb: fix payment control unit tests w/ errors.Is 2024-04-11 15:04:04 +02:00
Oliver Gugger
648fb22f63 multi: wrap all errors 2024-04-11 15:04:03 +02:00
Andras Banki-Horvath
9a28a4c105 kvdb: remove the unused SQL error mappers 2024-04-11 15:04:03 +02:00
Olaoluwa Osuntokun
cd0ca43a00 kvdb: don't do a critical log for db serialization errors
In this commit, we fix a bug that would cause the entire db to shutdown
if hit a panic (since db operations in the main buckets exit with a
panic) while executing a txn call back. This might be a postgres error
we need to check, so we don't want to bail out, and instead want to pass
up the error to the caller so we can retry if needed.
2024-04-11 15:04:03 +02:00
Olaoluwa Osuntokun
120d6dd297 channeldb: explicitly catch error in pruneGraphNodes
With the new postgres concurrency control, an error may come from a
bucket function that's actually a postgres error. In this case, we need
to return early so we can retry the txn. Otherwise, we'll be working
with an aborted tx, and never actually return the error so we don't auto
retry.
2024-04-11 15:04:03 +02:00
Olaoluwa Osuntokun
329fcc6498 kvdb+sqldb: update SQL error parsing to account for non wrapped errs
Some sub-systems like btcwallet will return an error from the database,
but they won't properly wrap it. As a result, we were unable to actually
catch the serialization errors in the first place. To work around this,
we'll now attempt to parse the error string directly.
2024-04-11 15:04:03 +02:00
Andras Banki-Horvath
43f4b14c28 kvdb+sqldb: use the same tx retry helper 2024-04-11 15:04:02 +02:00
Oliver Gugger
976f5d2760 Merge pull request #8603 from bhandras/sqldb-go-package
sqldb+invoices: turn sqldb into a go module
sqldb/v1.0.0
2024-04-10 08:51:00 +00:00
Oliver Gugger
971281deae Merge pull request #8576 from mohamedawnallah/check-outbound-peers-chain-backend
healthcheck: make sure chain backend has enough outbound peers
2024-04-10 07:39:16 +00:00
Andras Banki-Horvath
c804894849 docs: update release notes for 0.18 2024-04-09 20:46:12 +02:00