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())
|
mkey := string(maddr.Bytes())
|
||||||
switch nd.Delete(ctx, mkey) {
|
switch nd.Delete(ctx, mkey) {
|
||||||
case hamt.ErrNotFound:
|
|
||||||
return cid.Undef, aerrors.New(1, "miner not found in set on delete")
|
|
||||||
default:
|
default:
|
||||||
return cid.Undef, aerrors.HandleExternalError(err, "failed to delete miner from set")
|
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:
|
case nil:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ func mustIDAddress(i uint64) address.Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
pref := cid.NewPrefixV1(cid.Raw, mh.ID)
|
pref := cid.NewPrefixV1(cid.Raw, mh.IDENTITY)
|
||||||
mustSum := func(s string) cid.Cid {
|
mustSum := func(s string) cid.Cid {
|
||||||
c, err := pref.Sum([]byte(s))
|
c, err := pref.Sum([]byte(s))
|
||||||
if err != nil {
|
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) {
|
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()
|
defer span.End()
|
||||||
|
|
||||||
opts := ParseBSOptions(req.Options)
|
opts := ParseBSOptions(req.Options)
|
||||||
|
@ -12,9 +12,9 @@ import (
|
|||||||
blocks "github.com/ipfs/go-block-format"
|
blocks "github.com/ipfs/go-block-format"
|
||||||
bserv "github.com/ipfs/go-blockservice"
|
bserv "github.com/ipfs/go-blockservice"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
|
host "github.com/libp2p/go-libp2p-core/host"
|
||||||
inet "github.com/libp2p/go-libp2p-core/network"
|
inet "github.com/libp2p/go-libp2p-core/network"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
"github.com/libp2p/go-libp2p-core/peer"
|
||||||
host "github.com/libp2p/go-libp2p-host"
|
|
||||||
"go.opencensus.io/trace"
|
"go.opencensus.io/trace"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
@ -28,7 +28,6 @@ type BlockSync struct {
|
|||||||
bserv bserv.BlockService
|
bserv bserv.BlockService
|
||||||
host host.Host
|
host host.Host
|
||||||
|
|
||||||
syncPeersLk sync.Mutex
|
|
||||||
syncPeers *bsPeerTracker
|
syncPeers *bsPeerTracker
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/ipfs/go-car"
|
"github.com/ipfs/go-car"
|
||||||
offline "github.com/ipfs/go-ipfs-exchange-offline"
|
offline "github.com/ipfs/go-ipfs-exchange-offline"
|
||||||
"github.com/ipfs/go-merkledag"
|
"github.com/ipfs/go-merkledag"
|
||||||
peer "github.com/libp2p/go-libp2p-peer"
|
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||||
"go.opencensus.io/trace"
|
"go.opencensus.io/trace"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
@ -42,8 +42,6 @@ var log = logging.Logger("gen")
|
|||||||
const msgsPerBlock = 20
|
const msgsPerBlock = 20
|
||||||
|
|
||||||
type ChainGen struct {
|
type ChainGen struct {
|
||||||
accounts []address.Address
|
|
||||||
|
|
||||||
msgsPerBlock int
|
msgsPerBlock int
|
||||||
|
|
||||||
bs blockstore.Blockstore
|
bs blockstore.Blockstore
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
hamt "github.com/ipfs/go-hamt-ipld"
|
hamt "github.com/ipfs/go-hamt-ipld"
|
||||||
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
||||||
bstore "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"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ type MessagePool struct {
|
|||||||
localAddrs map[address.Address]struct{}
|
localAddrs map[address.Address]struct{}
|
||||||
|
|
||||||
pending map[address.Address]*msgSet
|
pending map[address.Address]*msgSet
|
||||||
pendingCount int
|
|
||||||
|
|
||||||
curTsLk sync.Mutex // DO NOT LOCK INSIDE lk
|
curTsLk sync.Mutex // DO NOT LOCK INSIDE lk
|
||||||
curTs *types.TipSet
|
curTs *types.TipSet
|
||||||
@ -81,7 +80,6 @@ type MessagePool struct {
|
|||||||
type msgSet struct {
|
type msgSet struct {
|
||||||
msgs map[uint64]*types.SignedMessage
|
msgs map[uint64]*types.SignedMessage
|
||||||
nextNonce uint64
|
nextNonce uint64
|
||||||
curBalance types.BigInt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMsgSet() *msgSet {
|
func newMsgSet() *msgSet {
|
||||||
@ -572,9 +570,7 @@ func (mp *MessagePool) MessagesForBlocks(blks []*types.BlockHeader) ([]*types.Si
|
|||||||
if err != nil {
|
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)
|
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, smsgs...)
|
||||||
out = append(out, msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, msg := range bmsgs {
|
for _, msg := range bmsgs {
|
||||||
smsg := mp.RecoverSig(msg)
|
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) {
|
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()
|
defer span.End()
|
||||||
|
|
||||||
from := vm.buf
|
from := vm.buf
|
||||||
|
@ -72,5 +72,4 @@ func main() {
|
|||||||
log.Warnf("%+v", err)
|
log.Warnf("%+v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ eventLoop:
|
|||||||
time.Sleep(time.Until(btime))
|
time.Sleep(time.Until(btime))
|
||||||
} else {
|
} else {
|
||||||
log.Warnw("mined block in the past", "block-time", btime,
|
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{})
|
mWon := make(map[address.Address]struct{})
|
||||||
|
@ -29,7 +29,6 @@ const (
|
|||||||
fsAPIToken = "token"
|
fsAPIToken = "token"
|
||||||
fsConfig = "config.toml"
|
fsConfig = "config.toml"
|
||||||
fsDatastore = "datastore"
|
fsDatastore = "datastore"
|
||||||
fsLibp2pKey = "libp2p.priv"
|
|
||||||
fsLock = "repo.lock"
|
fsLock = "repo.lock"
|
||||||
fsKeystore = "keystore"
|
fsKeystore = "keystore"
|
||||||
)
|
)
|
||||||
|
@ -27,7 +27,7 @@ type PeerMgr struct {
|
|||||||
|
|
||||||
// peerLeads is a set of peers we hear about through the network
|
// 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
|
// 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
|
peersLk sync.Mutex
|
||||||
peers map[peer.ID]struct{}
|
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)
|
cid, err := prefix.Sum(block.Data)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
blk, err := blocks.NewBlockWithCid(block.Data, cid)
|
blk, err := blocks.NewBlockWithCid(block.Data, cid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -3,7 +3,6 @@ package storage
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -36,10 +35,6 @@ type Miner struct {
|
|||||||
maddr address.Address
|
maddr address.Address
|
||||||
worker address.Address
|
worker address.Address
|
||||||
|
|
||||||
// PoSt
|
|
||||||
postLk sync.Mutex
|
|
||||||
schedPost uint64
|
|
||||||
|
|
||||||
// Sealing
|
// Sealing
|
||||||
sb *sectorbuilder.SectorBuilder
|
sb *sectorbuilder.SectorBuilder
|
||||||
sectors *statestore.StateStore
|
sectors *statestore.StateStore
|
||||||
|
Loading…
Reference in New Issue
Block a user