lntemp+lntest: fix make lint

This commit is contained in:
yyforyongyu 2022-10-25 12:30:12 +08:00
parent 0d29f154db
commit 14f45d0722
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
4 changed files with 18 additions and 4 deletions

View File

@ -27,6 +27,14 @@ const (
// defaultMinerFeeRate specifies the fee rate in sats when sending
// outputs from the miner.
defaultMinerFeeRate = 7500
// numBlocksSendOutput specifies the number of blocks to mine after
// sending outputs from the miner.
numBlocksSendOutput = 2
// numBlocksOpenChannel specifies the number of blocks mined when
// opening a channel.
numBlocksOpenChannel = 6
)
// TestCase defines a test case that's been used in the integration test.
@ -188,13 +196,13 @@ func (h *HarnessTest) SetupStandbyNodes() {
PkScript: addrScript,
Value: 10 * btcutil.SatoshiPerBitcoin,
}
h.Miner.SendOutput(output, 7500)
h.Miner.SendOutput(output, defaultMinerFeeRate)
}
}
// We generate several blocks in order to give the outputs created
// above a good number of confirmations.
h.MineBlocks(2)
h.MineBlocks(numBlocksSendOutput)
// Now we want to wait for the nodes to catch up.
h.WaitForBlockchainSync(h.Alice)
@ -280,6 +288,8 @@ func (h *HarnessTest) resetStandbyNodes(t *testing.T) {
// which resets all the standby nodes' configs back to its original state and
// create snapshots of each nodes' internal state.
func (h *HarnessTest) Subtest(t *testing.T) *HarnessTest {
t.Helper()
st := &HarnessTest{
T: t,
manager: h.manager,
@ -440,6 +450,7 @@ func (h *HarnessTest) Shutdown(node *node.HarnessNode) {
err := wait.NoError(func() error {
return h.manager.shutdownNode(node)
}, DefaultTimeout)
require.NoErrorf(h, err, "unable to shutdown %v", node.Name())
}
@ -749,7 +760,7 @@ func (h *HarnessTest) OpenChannel(alice, bob *node.HarnessNode,
// channel has been opened. The funding transaction should be found
// within the first newly mined block. We mine 6 blocks so that in the
// case that the channel is public, it is announced to the network.
block := h.MineBlocksAndAssertNumTxes(6, 1)[0]
block := h.MineBlocksAndAssertNumTxes(numBlocksOpenChannel, 1)[0]
// Wait for the channel open event.
fundingChanPoint := h.WaitForChannelOpenEvent(chanOpenUpdate)

View File

@ -325,6 +325,7 @@ func (h *HarnessTest) ReceiveCloseChannelUpdate(
case <-time.After(DefaultTimeout):
require.Fail(h, "timeout", "timeout waiting for close channel "+
"update sent")
return nil, nil
case err := <-errChan:

View File

@ -500,7 +500,7 @@ func (hn *HarnessNode) waitTillServerState(
func (hn *HarnessNode) initLightningClient() error {
// Wait until the server is fully started.
if err := hn.WaitUntilServerActive(); err != nil {
return fmt.Errorf("waiting for server active: %v", err)
return fmt.Errorf("waiting for server active: %w", err)
}
// Set the harness node's pubkey to what the node claims in GetInfo.

View File

@ -541,6 +541,8 @@ func parseDerivationPath(path string) ([]uint32, error) {
// should be run in a goroutine and is used to test nodes with the zero-conf
// feature bit.
func acceptChannel(t *testing.T, zeroConf bool, stream rpc.AcceptorClient) {
t.Helper()
req, err := stream.Recv()
require.NoError(t, err)