more of that sweet staticcheck goodness
This commit is contained in:
parent
a45fe8a7f9
commit
613a0a05a0
@ -747,10 +747,10 @@ func MinerSetRemove(ctx context.Context, vmctx types.VMContext, rcid cid.Cid, ma
|
||||
|
||||
mkey := string(maddr.Bytes())
|
||||
switch nd.Delete(ctx, mkey) {
|
||||
case hamt.ErrNotFound:
|
||||
return cid.Undef, aerrors.New(1, "miner not found in set on delete")
|
||||
default:
|
||||
return cid.Undef, aerrors.HandleExternalError(err, "failed to delete miner from set")
|
||||
case hamt.ErrNotFound:
|
||||
return cid.Undef, aerrors.New(1, "miner not found in set on delete")
|
||||
case nil:
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ func mustIDAddress(i uint64) address.Address {
|
||||
}
|
||||
|
||||
func init() {
|
||||
pref := cid.NewPrefixV1(cid.Raw, mh.ID)
|
||||
pref := cid.NewPrefixV1(cid.Raw, mh.IDENTITY)
|
||||
mustSum := func(s string) cid.Cid {
|
||||
c, err := pref.Sum([]byte(s))
|
||||
if err != nil {
|
||||
|
@ -108,7 +108,7 @@ func (bss *BlockSyncService) HandleStream(s inet.Stream) {
|
||||
}
|
||||
|
||||
func (bss *BlockSyncService) processRequest(ctx context.Context, req *BlockSyncRequest) (*BlockSyncResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "blocksync.ProcessRequest")
|
||||
_, span := trace.StartSpan(ctx, "blocksync.ProcessRequest")
|
||||
defer span.End()
|
||||
|
||||
opts := ParseBSOptions(req.Options)
|
||||
|
@ -12,9 +12,9 @@ import (
|
||||
blocks "github.com/ipfs/go-block-format"
|
||||
bserv "github.com/ipfs/go-blockservice"
|
||||
"github.com/ipfs/go-cid"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
inet "github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
host "github.com/libp2p/go-libp2p-host"
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -28,7 +28,6 @@ type BlockSync struct {
|
||||
bserv bserv.BlockService
|
||||
host host.Host
|
||||
|
||||
syncPeersLk sync.Mutex
|
||||
syncPeers *bsPeerTracker
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
"github.com/ipfs/go-car"
|
||||
offline "github.com/ipfs/go-ipfs-exchange-offline"
|
||||
"github.com/ipfs/go-merkledag"
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -42,8 +42,6 @@ var log = logging.Logger("gen")
|
||||
const msgsPerBlock = 20
|
||||
|
||||
type ChainGen struct {
|
||||
accounts []address.Address
|
||||
|
||||
msgsPerBlock int
|
||||
|
||||
bs blockstore.Blockstore
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
hamt "github.com/ipfs/go-hamt-ipld"
|
||||
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
||||
bstore "github.com/ipfs/go-ipfs-blockstore"
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
|
@ -60,7 +60,6 @@ type MessagePool struct {
|
||||
localAddrs map[address.Address]struct{}
|
||||
|
||||
pending map[address.Address]*msgSet
|
||||
pendingCount int
|
||||
|
||||
curTsLk sync.Mutex // DO NOT LOCK INSIDE lk
|
||||
curTs *types.TipSet
|
||||
@ -81,7 +80,6 @@ type MessagePool struct {
|
||||
type msgSet struct {
|
||||
msgs map[uint64]*types.SignedMessage
|
||||
nextNonce uint64
|
||||
curBalance types.BigInt
|
||||
}
|
||||
|
||||
func newMsgSet() *msgSet {
|
||||
@ -572,9 +570,7 @@ func (mp *MessagePool) MessagesForBlocks(blks []*types.BlockHeader) ([]*types.Si
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to get messages for apply block %s(height %d) (msgroot = %s): %w", b.Cid(), b.Height, b.Messages, err)
|
||||
}
|
||||
for _, msg := range smsgs {
|
||||
out = append(out, msg)
|
||||
}
|
||||
out = append(out, smsgs...)
|
||||
|
||||
for _, msg := range bmsgs {
|
||||
smsg := mp.RecoverSig(msg)
|
||||
|
@ -521,7 +521,7 @@ func (vm *VM) ActorBalance(addr address.Address) (types.BigInt, aerrors.ActorErr
|
||||
}
|
||||
|
||||
func (vm *VM) Flush(ctx context.Context) (cid.Cid, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "vm.Flush")
|
||||
_, span := trace.StartSpan(ctx, "vm.Flush")
|
||||
defer span.End()
|
||||
|
||||
from := vm.buf
|
||||
|
@ -72,5 +72,4 @@ func main() {
|
||||
log.Warnf("%+v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ eventLoop:
|
||||
time.Sleep(time.Until(btime))
|
||||
} else {
|
||||
log.Warnw("mined block in the past", "block-time", btime,
|
||||
"time", time.Now(), "duration", time.Now().Sub(btime))
|
||||
"time", time.Now(), "duration", time.Since(btime))
|
||||
}
|
||||
|
||||
mWon := make(map[address.Address]struct{})
|
||||
|
@ -29,7 +29,6 @@ const (
|
||||
fsAPIToken = "token"
|
||||
fsConfig = "config.toml"
|
||||
fsDatastore = "datastore"
|
||||
fsLibp2pKey = "libp2p.priv"
|
||||
fsLock = "repo.lock"
|
||||
fsKeystore = "keystore"
|
||||
)
|
||||
|
@ -27,7 +27,7 @@ type PeerMgr struct {
|
||||
|
||||
// peerLeads is a set of peers we hear about through the network
|
||||
// and who may be good peers to connect to for expanding our peer set
|
||||
peerLeads map[peer.ID]time.Time
|
||||
//peerLeads map[peer.ID]time.Time // TODO: unused
|
||||
|
||||
peersLk sync.Mutex
|
||||
peers map[peer.ID]struct{}
|
||||
|
@ -231,6 +231,9 @@ func (cst *clientStream) consumeBlockMessage(block Block, out io.Writer) (uint64
|
||||
}
|
||||
|
||||
cid, err := prefix.Sum(block.Data)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
blk, err := blocks.NewBlockWithCid(block.Data, cid)
|
||||
if err != nil {
|
||||
|
@ -3,7 +3,6 @@ package storage
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
@ -36,10 +35,6 @@ type Miner struct {
|
||||
maddr address.Address
|
||||
worker address.Address
|
||||
|
||||
// PoSt
|
||||
postLk sync.Mutex
|
||||
schedPost uint64
|
||||
|
||||
// Sealing
|
||||
sb *sectorbuilder.SectorBuilder
|
||||
sectors *statestore.StateStore
|
||||
|
Loading…
Reference in New Issue
Block a user