remove duplicated vars.

This commit is contained in:
Raúl Kripalani 2021-05-19 17:30:06 +01:00
parent 88c6642330
commit 625b18771d
2 changed files with 8 additions and 13 deletions

View File

@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"context" "context"
"fmt" "fmt"
"math"
"os" "os"
"testing" "testing"
"time" "time"
@ -30,15 +29,11 @@ import (
"github.com/filecoin-project/lotus/api/v0api" "github.com/filecoin-project/lotus/api/v0api"
"github.com/filecoin-project/lotus/api/v1api" "github.com/filecoin-project/lotus/api/v1api"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/stmgr"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node"
builder "github.com/filecoin-project/lotus/node/test" builder "github.com/filecoin-project/lotus/node/test"
) )
const maxLookbackCap = time.Duration(math.MaxInt64)
const maxStateWaitLookbackLimit = stmgr.LookbackNoLimit
func init() { func init() {
policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1)
policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048))
@ -53,7 +48,7 @@ func TestWalletMsig(t *testing.T) {
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
nodes := startNodes(ctx, t, blocktime, maxLookbackCap, maxStateWaitLookbackLimit) nodes := startNodes(ctx, t, blocktime, DefautLookbackCap, DefaultStateWaitLookbackLimit)
defer nodes.closer() defer nodes.closer()
lite := nodes.lite lite := nodes.lite
@ -187,7 +182,7 @@ func TestMsigCLI(t *testing.T) {
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
nodes := startNodesWithFunds(ctx, t, blocktime, maxLookbackCap, maxStateWaitLookbackLimit) nodes := startNodesWithFunds(ctx, t, blocktime, DefautLookbackCap, DefaultStateWaitLookbackLimit)
defer nodes.closer() defer nodes.closer()
lite := nodes.lite lite := nodes.lite
@ -200,7 +195,7 @@ func TestDealFlow(t *testing.T) {
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
nodes := startNodesWithFunds(ctx, t, blocktime, maxLookbackCap, maxStateWaitLookbackLimit) nodes := startNodesWithFunds(ctx, t, blocktime, DefautLookbackCap, DefaultStateWaitLookbackLimit)
defer nodes.closer() defer nodes.closer()
// For these tests where the block time is artificially short, just use // For these tests where the block time is artificially short, just use
@ -216,7 +211,7 @@ func TestCLIDealFlow(t *testing.T) {
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
nodes := startNodesWithFunds(ctx, t, blocktime, maxLookbackCap, maxStateWaitLookbackLimit) nodes := startNodesWithFunds(ctx, t, blocktime, DefautLookbackCap, DefaultStateWaitLookbackLimit)
defer nodes.closer() defer nodes.closer()
clitest.RunClientTest(t, cli.Commands, nodes.lite) clitest.RunClientTest(t, cli.Commands, nodes.lite)

View File

@ -32,8 +32,8 @@ import (
var log = logging.Logger("gateway") var log = logging.Logger("gateway")
const ( const (
LookbackCap = time.Hour * 24 DefautLookbackCap = time.Hour * 24
StateWaitLookbackLimit = abi.ChainEpoch(20) DefaultStateWaitLookbackLimit = abi.ChainEpoch(20)
) )
func main() { func main() {
@ -81,12 +81,12 @@ var runCmd = &cli.Command{
&cli.DurationFlag{ &cli.DurationFlag{
Name: "api-max-lookback", Name: "api-max-lookback",
Usage: "maximum duration allowable for tipset lookbacks", Usage: "maximum duration allowable for tipset lookbacks",
Value: LookbackCap, Value: DefautLookbackCap,
}, },
&cli.Int64Flag{ &cli.Int64Flag{
Name: "api-wait-lookback-limit", Name: "api-wait-lookback-limit",
Usage: "maximum number of blocks to search back through for message inclusion", Usage: "maximum number of blocks to search back through for message inclusion",
Value: int64(StateWaitLookbackLimit), Value: int64(DefaultStateWaitLookbackLimit),
}, },
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {