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

Beat [5/4]: fix itests for blockbeat #9227

Open
wants to merge 27 commits into
base: yy-blockbeat-end
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1329187
multi: optimize loggings around changes from `blockbeat`
yyforyongyu Oct 17, 2024
e1c466b
lntest+itest: fix `testSweepCPFPAnchorOutgoingTimeout`
yyforyongyu Oct 24, 2024
0b3a583
itest: fix `testSweepCPFPAnchorIncomingTimeout`
yyforyongyu Oct 24, 2024
9bd944e
itest: fix `testSweepHTLCs`
yyforyongyu Oct 24, 2024
809b196
itest: fix `testSweepCommitOutputAndAnchor`
yyforyongyu Oct 24, 2024
9c28202
itest: fix `testBumpForceCloseFee`
yyforyongyu Oct 17, 2024
7b55f27
itest: fix `testPaymentSucceededHTLCRemoteSwept`
yyforyongyu Oct 24, 2024
494ea82
lntest+itest: start flattening the multi-hop tests
yyforyongyu Oct 17, 2024
40e845f
itest: simplify and flatten `testMultiHopReceiverChainClaim`
yyforyongyu Oct 18, 2024
cdd43a6
lntest+itest: flatten `testMultiHopLocalForceCloseOnChainHtlcTimeout`
yyforyongyu Oct 18, 2024
d5806e5
lntest+itest: flatten `testMultiHopRemoteForceCloseOnChainHtlcTimeout`
yyforyongyu Oct 19, 2024
9116774
itest: flatten `testMultiHopHtlcLocalChainClaim`
yyforyongyu Oct 21, 2024
abd6601
itest: flatten `testMultiHopHtlcRemoteChainClaim`
yyforyongyu Oct 22, 2024
bcd86a8
itest: flatten `testMultiHopHtlcAggregation`
yyforyongyu Oct 23, 2024
5bc558e
itest: flatten `testHtlcTimeoutResolverExtractPreimageLocal`
yyforyongyu Oct 23, 2024
f2fc527
itest: flatten `testHtlcTimeoutResolverExtractPreimageRemote`
yyforyongyu Oct 23, 2024
b688252
itest: rename file to reflect the tests
yyforyongyu Oct 23, 2024
0f69894
itest: remove unnecessary force close
yyforyongyu Oct 23, 2024
47412b5
itest: remove redundant block mining in `testFailingChannel`
yyforyongyu Oct 24, 2024
4c40544
itest: remove redunant block mining in `testChannelFundingWithUnstabl…
yyforyongyu Oct 24, 2024
fd54b66
itest: remove redudant block in `testPsbtChanFundingWithUnstableUtxos`
yyforyongyu Oct 24, 2024
56dfad4
itest: remove redundant blocks in channel backup tests
yyforyongyu Oct 24, 2024
4022007
itest+lntest: fix channel force close test
yyforyongyu Jun 29, 2024
5e2caeb
itest: flatten and fix `testWatchtower`
yyforyongyu Oct 25, 2024
2825ce5
itest: remove redundant block in multiple tests
yyforyongyu Oct 25, 2024
61141c1
itest: assert payment status after sending
yyforyongyu Oct 24, 2024
eabf0a5
lntest+itest: remove the usage of `ht.AssertActiveHtlcs`
yyforyongyu Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions chainio/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/btcsuite/btclog/v2"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/lnutils"
"golang.org/x/sync/errgroup"
)

Expand Down Expand Up @@ -136,6 +137,10 @@ func (b *BlockbeatDispatcher) dispatchBlocks(
return
}

// Log a separator so it's easier to identify when a
// new block arrives for subsystems.
clog.Debugf("%v", lnutils.NewSeparatorClosure())

clog.Infof("Received new block %v at height %d, "+
"notifying consumers...", blockEpoch.Hash,
blockEpoch.Height)
Expand Down
8 changes: 4 additions & 4 deletions contractcourt/channel_arbitrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ func (c *ChannelArbitrator) Start(state *chanArbStartState,
}
}

log.Debugf("Starting ChannelArbitrator(%v), htlc_set=%v, state=%v",
log.Tracef("Starting ChannelArbitrator(%v), htlc_set=%v, state=%v",
c.cfg.ChanPoint, lnutils.SpewLogClosure(c.activeHTLCs),
state.currentState)

Expand Down Expand Up @@ -2618,14 +2618,14 @@ func (c *ChannelArbitrator) replaceResolver(oldResolver,
func (c *ChannelArbitrator) resolveContract(currentContract ContractResolver) {
defer c.wg.Done()

log.Debugf("ChannelArbitrator(%v): attempting to resolve %T",
log.Tracef("ChannelArbitrator(%v): attempting to resolve %T",
c.cfg.ChanPoint, currentContract)

// Until the contract is fully resolved, we'll continue to iteratively
// resolve the contract one step at a time.
for !currentContract.IsResolved() {
log.Debugf("ChannelArbitrator(%v): contract %T not yet resolved",
c.cfg.ChanPoint, currentContract)
log.Tracef("ChannelArbitrator(%v): contract %T not yet "+
"resolved", c.cfg.ChanPoint, currentContract)

select {

Expand Down
48 changes: 13 additions & 35 deletions itest/list_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ var allTestCases = []*lntest.TestCase{
Name: "basic funding flow",
TestFunc: testBasicChannelFunding,
},
{
Name: "multi hop receiver chain claim",
TestFunc: testMultiHopReceiverChainClaim,
},
{
Name: "external channel funding",
TestFunc: testExternalFundingChanPoint,
Expand Down Expand Up @@ -153,18 +149,6 @@ var allTestCases = []*lntest.TestCase{
Name: "addpeer config",
TestFunc: testAddPeerConfig,
},
{
Name: "multi hop htlc local timeout",
TestFunc: testMultiHopHtlcLocalTimeout,
},
{
Name: "multi hop local force close on-chain htlc timeout",
TestFunc: testMultiHopLocalForceCloseOnChainHtlcTimeout,
},
{
Name: "multi hop remote force close on-chain htlc timeout",
TestFunc: testMultiHopRemoteForceCloseOnChainHtlcTimeout,
},
{
Name: "private channel update policy",
TestFunc: testUpdateChannelPolicyForPrivateChannel,
Expand Down Expand Up @@ -226,11 +210,15 @@ var allTestCases = []*lntest.TestCase{
TestFunc: testChannelUnsettledBalance,
},
{
Name: "channel force closure",
TestFunc: testChannelForceClosure,
Name: "channel force closure anchor",
TestFunc: testChannelForceClosureAnchor,
},
{
Name: "channel force closure simple taproot",
TestFunc: testChannelForceClosureSimpleTaproot,
},
{
Name: "failing link",
Name: "failing channel",
TestFunc: testFailingChannel,
},
{
Expand Down Expand Up @@ -313,18 +301,6 @@ var allTestCases = []*lntest.TestCase{
Name: "REST API",
TestFunc: testRestAPI,
},
{
Name: "multi hop htlc local chain claim",
TestFunc: testMultiHopHtlcLocalChainClaim,
},
{
Name: "multi hop htlc remote chain claim",
TestFunc: testMultiHopHtlcRemoteChainClaim,
},
{
Name: "multi hop htlc aggregation",
TestFunc: testMultiHopHtlcAggregation,
},
{
Name: "revoked uncooperative close retribution",
TestFunc: testRevokedCloseRetribution,
Expand Down Expand Up @@ -574,10 +550,6 @@ var allTestCases = []*lntest.TestCase{
Name: "lookup htlc resolution",
TestFunc: testLookupHtlcResolution,
},
{
Name: "watchtower",
TestFunc: testWatchtower,
},
{
Name: "channel fundmax",
TestFunc: testChannelFundMax,
Expand Down Expand Up @@ -715,3 +687,9 @@ var allTestCases = []*lntest.TestCase{
TestFunc: testQuiescence,
},
}

func init() {
// Register subtests.
allTestCases = append(allTestCases, multiHopForceCloseTestCases...)
allTestCases = append(allTestCases, watchtowerTestCases...)
}
28 changes: 12 additions & 16 deletions itest/lnd_channel_backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1320,12 +1320,20 @@ func testDataLossProtection(ht *lntest.HarnessTest) {
// information Dave needs to sweep his funds.
require.NoError(ht, restartDave(), "unable to restart Eve")

// Mine a block to trigger Dave's chain watcher to process Carol's sweep
// tx.
//
// TODO(yy): remove this block once the blockbeat starts remembering
// its last processed block and can handle looking for spends in the
// past blocks.
ht.MineEmptyBlocks(1)

// Make sure Dave still has the pending force close channel.
ht.AssertNumPendingForceClose(dave, 1)

// Dave should have a pending sweep.
ht.AssertNumPendingSweeps(dave, 1)

// Mine a block to trigger the sweep.
ht.MineBlocks(1)

// Dave should sweep his funds.
ht.AssertNumTxsInMempool(1)

Expand Down Expand Up @@ -1482,7 +1490,6 @@ func assertTimeLockSwept(ht *lntest.HarnessTest, carol, dave *node.HarnessNode,
expectedTxes := 1

// Mine a block to trigger the sweeps.
ht.MineBlocks(1)
ht.AssertNumTxsInMempool(expectedTxes)

// Carol should consider the channel pending force close (since she is
Expand Down Expand Up @@ -1512,7 +1519,7 @@ func assertTimeLockSwept(ht *lntest.HarnessTest, carol, dave *node.HarnessNode,
// The commit sweep resolver publishes the sweep tx at defaultCSV-1 and
// we already mined one block after the commitment was published, and
// one block to trigger Carol's sweeps, so take that into account.
ht.MineEmptyBlocks(1)
ht.MineBlocks(2)
ht.AssertNumPendingSweeps(dave, 2)

// Mine a block to trigger the sweeps.
Expand Down Expand Up @@ -1615,8 +1622,6 @@ func assertDLPExecuted(ht *lntest.HarnessTest,
// output and the other for her anchor.
ht.AssertNumPendingSweeps(carol, 2)

// Mine a block to trigger the sweep.
ht.MineEmptyBlocks(1)
ht.MineBlocksAndAssertNumTxes(1, 1)

// Now the channel should be fully closed also from Carol's POV.
Expand All @@ -1635,8 +1640,6 @@ func assertDLPExecuted(ht *lntest.HarnessTest,
// output and the other for his anchor.
ht.AssertNumPendingSweeps(dave, 2)

// Mine a block to trigger the sweep.
ht.MineEmptyBlocks(1)
ht.MineBlocksAndAssertNumTxes(1, 1)

// Now Dave should consider the channel fully closed.
Expand All @@ -1652,10 +1655,6 @@ func assertDLPExecuted(ht *lntest.HarnessTest,
ht.AssertNumPendingSweeps(dave, 1)
}

// Mine one block to trigger the sweeper to sweep.
ht.MineEmptyBlocks(1)
blocksMined++

// Expect one tx - the commitment sweep from Dave. For anchor
// channels, we expect the two anchor sweeping txns to be
// failed due they are uneconomical.
Expand All @@ -1673,9 +1672,6 @@ func assertDLPExecuted(ht *lntest.HarnessTest,
// commitmment was published, so take that into account.
ht.MineEmptyBlocks(int(defaultCSV - blocksMined))

// Mine one block to trigger the sweeper to sweep.
ht.MineEmptyBlocks(1)

// Carol should have two pending sweeps:
// 1. her commit output.
// 2. her anchor output, if this is anchor channel.
Expand Down
2 changes: 1 addition & 1 deletion itest/lnd_channel_balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func testChannelUnsettledBalance(ht *lntest.HarnessTest) {
TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat,
}
alice.RPC.SendPayment(req)
ht.SendPaymentAssertInflight(alice, req)
}()
}

Expand Down
Loading
Loading