Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1/3]: prepare blockbeat #7

Open
wants to merge 611 commits into
base: yy-itest-miner
Choose a base branch
from
Open

Conversation

yyforyongyu
Copy link
Owner

@yyforyongyu yyforyongyu commented Jun 5, 2024

This PR prepares the incoming blockbeat PRs, the changes are,

  • BlockEpoch now has the block data instead of block header. This block data is used in the incoming blockbeat PR to query spending transactions.
  • Added a new sweeping state, TxError. Inputs resulted in this state will be removed from the sweeper.
  • check input's CSV and CLTV in the sweeper, and skip sweeping them if not matured.
  • When calculating the deadline, make sure it's derived from mature height, not current height.

Copy link

github-actions bot commented Jun 5, 2024

Pull reviewers stats

Stats of the last 30 days for lnd:

User Total reviews Time to review Total comments

@coveralls
Copy link

coveralls commented Jun 5, 2024

Pull Request Test Coverage Report for Build 9382071970

Details

  • 198 of 266 (74.44%) changed or added relevant lines in 10 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on yy-prepare-blockbeat at 57.43%

Changes Missing Coverage Covered Lines Changed/Added Lines %
config_builder.go 0 1 0.0%
chainntnfs/neutrinonotify/neutrino.go 15 17 88.24%
chainntnfs/test/test_interface.go 5 8 62.5%
sweep/fee_bumper.go 68 91 74.73%
sweep/sweeper.go 58 97 59.79%
Totals Coverage Status
Change from base Build 9382066140: 57.4%
Covered Lines: 92481
Relevant Lines: 161033

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 13, 2024

Pull Request Test Coverage Report for Build 9497610191

Details

  • 198 of 266 (74.44%) changed or added relevant lines in 10 files are covered.
  • 18035 unchanged lines in 231 files lost coverage.
  • Overall coverage decreased (-0.8%) to 57.401%

Changes Missing Coverage Covered Lines Changed/Added Lines %
config_builder.go 0 1 0.0%
chainntnfs/neutrinonotify/neutrino.go 15 17 88.24%
chainntnfs/test/test_interface.go 5 8 62.5%
sweep/fee_bumper.go 68 91 74.73%
sweep/sweeper.go 58 97 59.79%
Files with Coverage Reduction New Missed Lines %
labels/labels.go 1 73.33%
channeldb/invoices.go 2 84.03%
queue/gc_queue.go 2 96.51%
channeldb/witness_cache.go 2 77.78%
funding/batch.go 2 81.48%
invoices/invoice_expiry_watcher.go 2 86.26%
chanacceptor/chainedacceptor.go 2 81.48%
channeldb/forwarding_package.go 2 74.95%
brontide/listener.go 2 66.67%
channeldb/payment_control.go 2 77.24%
Totals Coverage Status
Change from base Build 9497607705: -0.8%
Covered Lines: 92531
Relevant Lines: 161200

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 13, 2024

Pull Request Test Coverage Report for Build 9498816450

Details

  • 198 of 266 (74.44%) changed or added relevant lines in 10 files are covered.
  • 18190 unchanged lines in 230 files lost coverage.
  • Overall coverage decreased (-0.9%) to 57.371%

Changes Missing Coverage Covered Lines Changed/Added Lines %
config_builder.go 0 1 0.0%
chainntnfs/neutrinonotify/neutrino.go 15 17 88.24%
chainntnfs/test/test_interface.go 5 8 62.5%
sweep/fee_bumper.go 68 91 74.73%
sweep/sweeper.go 58 97 59.79%
Files with Coverage Reduction New Missed Lines %
labels/labels.go 1 73.33%
channeldb/invoices.go 2 84.03%
watchtower/wtclient/session_negotiator.go 2 80.32%
channeldb/witness_cache.go 2 77.78%
funding/batch.go 2 81.48%
invoices/invoice_expiry_watcher.go 2 86.26%
chanacceptor/chainedacceptor.go 2 81.48%
brontide/listener.go 2 66.67%
channeldb/payment_control.go 2 77.24%
watchtower/wtclient/candidate_iterator.go 2 96.0%
Totals Coverage Status
Change from base Build 9498717253: -0.9%
Covered Lines: 92482
Relevant Lines: 161200

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 17, 2024

Pull Request Test Coverage Report for Build 9546079138

Details

  • 198 of 266 (74.44%) changed or added relevant lines in 10 files are covered.
  • 18178 unchanged lines in 230 files lost coverage.
  • Overall coverage decreased (-0.9%) to 57.377%

Changes Missing Coverage Covered Lines Changed/Added Lines %
config_builder.go 0 1 0.0%
chainntnfs/neutrinonotify/neutrino.go 15 17 88.24%
chainntnfs/test/test_interface.go 5 8 62.5%
sweep/fee_bumper.go 68 91 74.73%
sweep/sweeper.go 58 97 59.79%
Files with Coverage Reduction New Missed Lines %
labels/labels.go 1 73.33%
channeldb/invoices.go 2 84.03%
channeldb/witness_cache.go 2 77.78%
funding/batch.go 2 81.48%
invoices/invoice_expiry_watcher.go 2 86.26%
chanacceptor/chainedacceptor.go 2 81.48%
brontide/listener.go 2 66.67%
channeldb/payment_control.go 2 77.24%
watchtower/wtclient/candidate_iterator.go 2 96.0%
record/mpp.go 2 80.0%
Totals Coverage Status
Change from base Build 9546074656: -0.9%
Covered Lines: 92521
Relevant Lines: 161250

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 17, 2024

Pull Request Test Coverage Report for Build 9548430627

Details

  • 198 of 266 (74.44%) changed or added relevant lines in 10 files are covered.
  • 18174 unchanged lines in 229 files lost coverage.
  • Overall coverage decreased (-0.9%) to 57.372%

Changes Missing Coverage Covered Lines Changed/Added Lines %
config_builder.go 0 1 0.0%
chainntnfs/neutrinonotify/neutrino.go 15 17 88.24%
chainntnfs/test/test_interface.go 5 8 62.5%
sweep/fee_bumper.go 68 91 74.73%
sweep/sweeper.go 58 97 59.79%
Files with Coverage Reduction New Missed Lines %
lnwallet/test/test_interface.go 1 77.73%
labels/labels.go 1 73.33%
channeldb/invoices.go 2 84.03%
watchtower/wtclient/session_negotiator.go 2 80.32%
channeldb/witness_cache.go 2 77.78%
funding/batch.go 2 81.48%
invoices/invoice_expiry_watcher.go 2 86.26%
chanacceptor/chainedacceptor.go 2 81.48%
brontide/listener.go 2 66.67%
channeldb/payment_control.go 2 77.24%
Totals Coverage Status
Change from base Build 9546074656: -0.9%
Covered Lines: 92513
Relevant Lines: 161250

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 20, 2024

Pull Request Test Coverage Report for Build 9598606296

Details

  • 198 of 266 (74.44%) changed or added relevant lines in 10 files are covered.
  • 18192 unchanged lines in 234 files lost coverage.
  • Overall coverage decreased (-0.9%) to 57.376%

Changes Missing Coverage Covered Lines Changed/Added Lines %
config_builder.go 0 1 0.0%
chainntnfs/neutrinonotify/neutrino.go 15 17 88.24%
chainntnfs/test/test_interface.go 5 8 62.5%
sweep/fee_bumper.go 68 91 74.73%
sweep/sweeper.go 58 97 59.79%
Files with Coverage Reduction New Missed Lines %
labels/labels.go 1 73.33%
channeldb/invoices.go 2 84.03%
watchtower/wtclient/session_negotiator.go 2 80.32%
channeldb/witness_cache.go 2 77.78%
funding/batch.go 2 81.48%
invoices/invoice_expiry_watcher.go 2 86.26%
chanacceptor/chainedacceptor.go 2 81.48%
channeldb/forwarding_package.go 2 74.95%
channeldb/payment_control.go 2 77.24%
watchtower/wtclient/candidate_iterator.go 2 96.0%
Totals Coverage Status
Change from base Build 9598603079: -0.9%
Covered Lines: 92574
Relevant Lines: 161346

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 24, 2024

Pull Request Test Coverage Report for Build 9646711542

Details

  • 198 of 266 (74.44%) changed or added relevant lines in 10 files are covered.
  • 18148 unchanged lines in 230 files lost coverage.
  • Overall coverage decreased (-0.8%) to 57.395%

Changes Missing Coverage Covered Lines Changed/Added Lines %
config_builder.go 0 1 0.0%
chainntnfs/neutrinonotify/neutrino.go 15 17 88.24%
chainntnfs/test/test_interface.go 5 8 62.5%
sweep/fee_bumper.go 68 91 74.73%
sweep/sweeper.go 58 97 59.79%
Files with Coverage Reduction New Missed Lines %
labels/labels.go 1 73.33%
channeldb/invoices.go 2 84.03%
watchtower/wtclient/queue.go 2 84.84%
channeldb/witness_cache.go 2 77.78%
funding/batch.go 2 81.48%
invoices/invoice_expiry_watcher.go 2 86.26%
chanacceptor/chainedacceptor.go 2 81.48%
brontide/listener.go 2 66.67%
channeldb/payment_control.go 2 77.24%
watchtower/wtclient/candidate_iterator.go 2 96.0%
Totals Coverage Status
Change from base Build 9646709019: -0.8%
Covered Lines: 92605
Relevant Lines: 161346

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 25, 2024

Pull Request Test Coverage Report for Build 9663141753

Details

  • 198 of 266 (74.44%) changed or added relevant lines in 10 files are covered.
  • 17999 unchanged lines in 232 files lost coverage.
  • Overall coverage decreased (-0.7%) to 57.396%

Changes Missing Coverage Covered Lines Changed/Added Lines %
config_builder.go 0 1 0.0%
chainntnfs/neutrinonotify/neutrino.go 15 17 88.24%
chainntnfs/test/test_interface.go 5 8 62.5%
sweep/fee_bumper.go 68 91 74.73%
sweep/sweeper.go 58 97 59.79%
Files with Coverage Reduction New Missed Lines %
labels/labels.go 1 73.33%
channeldb/invoices.go 2 84.03%
channeldb/witness_cache.go 2 77.78%
funding/batch.go 2 81.48%
invoices/invoice_expiry_watcher.go 2 86.26%
chanacceptor/chainedacceptor.go 2 81.48%
watchtower/wtclient/session_queue.go 2 82.92%
channeldb/forwarding_package.go 2 74.95%
brontide/listener.go 2 66.67%
channeldb/payment_control.go 2 77.24%
Totals Coverage Status
Change from base Build 9649911319: -0.7%
Covered Lines: 92609
Relevant Lines: 161350

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 27, 2024

Pull Request Test Coverage Report for Build 9701688598

Details

  • 198 of 266 (74.44%) changed or added relevant lines in 10 files are covered.
  • 18192 unchanged lines in 230 files lost coverage.
  • Overall coverage decreased (-0.9%) to 57.39%

Changes Missing Coverage Covered Lines Changed/Added Lines %
config_builder.go 0 1 0.0%
chainntnfs/neutrinonotify/neutrino.go 15 17 88.24%
chainntnfs/test/test_interface.go 5 8 62.5%
sweep/fee_bumper.go 68 91 74.73%
sweep/sweeper.go 58 97 59.79%
Files with Coverage Reduction New Missed Lines %
lnwallet/test/test_interface.go 1 77.73%
labels/labels.go 1 73.33%
channeldb/invoices.go 2 84.03%
channeldb/witness_cache.go 2 77.78%
funding/batch.go 2 81.48%
invoices/invoice_expiry_watcher.go 2 86.26%
chanacceptor/chainedacceptor.go 2 81.48%
channeldb/forwarding_package.go 2 74.95%
brontide/listener.go 2 66.67%
channeldb/payment_control.go 2 77.24%
Totals Coverage Status
Change from base Build 9701664506: -0.9%
Covered Lines: 92575
Relevant Lines: 161308

💛 - Coveralls

starius and others added 29 commits October 11, 2024 10:00
It is used for sweeping time-locked outputs as well as non time-locked outputs.
This pure function creates signed commit transaction, using various
inputs passed as struct TaprootSignedCommitTxInputs and a signer.

This is needed to be able to store the inputs without a signature
in SCB and sign the transaction in chantools scbforceclose.

See https://github.com/lightningnetwork/lnd/pull/8183/files#r1423959791
Previous to this change taproot assets channels and simple taproot channels were
considered the same in the context of chanbackup package, since they stored the
same data. In the following commits we are adding the data needed to produce a
signed commitment transaction from a SCB file and in order to do that we need to
add more fields and a custom channel gets one additional field (TapscriptRoot)
compared to a simple taproot channel. So now we have to distinguish these kinds
of channels in chanbackup package.

See PR lightningnetwork#8183 for more details.
The field is optional. It stores inputs needed to produce signed commit tx using
chantools scbforceclose, which calls function GetSignedCommitTx. New backups
have this field filled if commit tx is available (for all cases except when DLP
is active). If a backup has this data, the field is filled from it, otherwise it
is kept empty.

Modified test function genRandomOpenChannelShell to cover new types of channels
(simple taproot channel and custom channel) and to cover combinations of bits.
Make sure that TapscriptRoot field is properly packed and unpacked.
This method inserts channel updates and waits for them to be processed. It will
be used to update channel.backup upon LND shutdown.
This is needed to keep channel.backup up-to-date if the node is stopped.
…tic-backup

chanbackup, server, rpcserver: put close unsigned tx, remote signature and commit height to SCB
In line with previous commits we are progressively removing the
mutateState argument from this call stack for a more principled
software design approach.

NOTE FOR REVIEWERS:
We take a naive approach to updating the tests here and simply
take the functionality we are removing from evaluateHTLCView and
run it directly after the function in the test suite.

It's possible that we should instead remove this from the test
suite altogether but I opted to take a more conservative approach
with respect to reducing the scope of tests. If you have opinions
here, please make them known.
This commit removes another raw boolean value and replaces it with
a more clear type/name. This will also assist us when we later try
and consolidate the logic of evaluateHTLCView into a single
coherent computation.
This commit moves the collection of updates behind a Dual structure.
This allows us in a later commit to index into it via a ChannelParty
parameter which will simplify the loops in evaluateHTLCView.
This commit simplifies how we compute the commitment fee rate based
off of the live updates. Prior to this commit we processed all of
the FeeUpdate paymentDescriptors of both ChannelParty's. Now we only
process the last FeeUpdate of the OpeningParty
We had four for-loops in evaluateHTLCView that were exact mirror
images of each other. By making use of the new ChannelParty and
Dual facilities introduced in prior commits, we consolidate these
into two for-loops.
This further reduces loop complexity in evaluateHTLCView by using
explicit filter steps rather than loop continue statements.
This commit observes that processAddEntry and processRemoveEntry
are only invoked at a single call-site. Here we inline them at their
call-sites, which will unlock further simplifications of the code
that will allow us to remove pointer mutations in favor of explicit
expression oriented programming.

We also delete the tests associated with these functions, the overall
functionality is implicitly tested by the TestEvaluateHTLCView tests.
Here we return the balance deltas from evaluateHTLCView rather than
passing in references to variables that will be modified. It is a
far cleaner and compositional approach which allows readers of this
code to more effectively reason about the code without having to
keep the whole codebase in their head.
…valuate-htlc-view

[KILO]: DynComms Prefactor: Refactor/evaluate htlc view
So the block data can be used by subsystems without calling `GetBlock`.
Also updated the loggings. This new state will be used in the following
commit.
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.
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.
Also updated `handlePendingSweepsReq` to skip immature inputs so the
returned results are the same as those in pre-0.18.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.