mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
build: enable deadcode linter
* also fixes warnings generated by linter * fixes #15473
This commit is contained in:
parent
b0190189a3
commit
02c2242791
37 changed files with 56 additions and 16 deletions
|
|
@ -50,6 +50,7 @@ func U256(n *big.Int) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// checks whether the given reflect value is signed. This also works for slices with a number type
|
// checks whether the given reflect value is signed. This also works for slices with a number type
|
||||||
|
// nolint: deadcode
|
||||||
func isSigned(v reflect.Value) bool {
|
func isSigned(v reflect.Value) bool {
|
||||||
switch v.Type() {
|
switch v.Type() {
|
||||||
case int_ts, int8_ts, int16_ts, int32_ts, int64_ts, int_t, int8_t, int16_t, int32_t, int64_t:
|
case int_ts, int8_ts, int16_ts, int32_ts, int64_ts, int_t, int8_t, int16_t, int32_t, int64_t:
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ type ledgerParam1 byte
|
||||||
// specific opcodes. The same parameter values may be reused between opcodes.
|
// specific opcodes. The same parameter values may be reused between opcodes.
|
||||||
type ledgerParam2 byte
|
type ledgerParam2 byte
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
ledgerOpRetrieveAddress ledgerOpcode = 0x02 // Returns the public key and Ethereum address for a given BIP 32 path
|
ledgerOpRetrieveAddress ledgerOpcode = 0x02 // Returns the public key and Ethereum address for a given BIP 32 path
|
||||||
ledgerOpSignTransaction ledgerOpcode = 0x04 // Signs an Ethereum transaction after having the user validate the parameters
|
ledgerOpSignTransaction ledgerOpcode = 0x04 // Signs an Ethereum transaction after having the user validate the parameters
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,14 @@ func doLint(cmdline []string) {
|
||||||
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v1"), "--install")
|
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v1"), "--install")
|
||||||
|
|
||||||
// Run fast linters batched together
|
// Run fast linters batched together
|
||||||
configs := []string{"--vendor", "--disable-all", "--enable=vet", "--enable=gofmt", "--enable=misspell"}
|
configs := []string{"--vendor", "-t",
|
||||||
|
"--disable-all",
|
||||||
|
"--exclude=cmd/faucet/website.go",
|
||||||
|
"--enable=vet",
|
||||||
|
"--enable=gofmt",
|
||||||
|
"--enable=misspell",
|
||||||
|
"--enable=deadcode",
|
||||||
|
}
|
||||||
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v1"), append(configs, packages...)...)
|
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v1"), append(configs, packages...)...)
|
||||||
|
|
||||||
// Run slow linters one by one
|
// Run slow linters one by one
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Clique proof-of-authority protocol constants.
|
// Clique proof-of-authority protocol constants.
|
||||||
|
// nolint: deadcode
|
||||||
var (
|
var (
|
||||||
epochLength = uint64(30000) // Default number of blocks after which to checkpoint and reset the pending votes
|
epochLength = uint64(30000) // Default number of blocks after which to checkpoint and reset the pending votes
|
||||||
blockPeriod = uint64(15) // Default minimum difference between two consecutive block's timestamps
|
blockPeriod = uint64(15) // Default minimum difference between two consecutive block's timestamps
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,7 @@ func swap(buffer []byte) {
|
||||||
// prepare converts an ethash cache or dataset from a byte stream into the internal
|
// prepare converts an ethash cache or dataset from a byte stream into the internal
|
||||||
// int representation. All ethash methods work with ints to avoid constant byte to
|
// int representation. All ethash methods work with ints to avoid constant byte to
|
||||||
// int conversions as well as to handle both little and big endian systems.
|
// int conversions as well as to handle both little and big endian systems.
|
||||||
|
// nolint: deadcode
|
||||||
func prepare(dest []uint32, src []byte) {
|
func prepare(dest []uint32, src []byte) {
|
||||||
for i := 0; i < len(dest); i++ {
|
for i := 0; i < len(dest); i++ {
|
||||||
dest[i] = binary.LittleEndian.Uint32(src[i*4:])
|
dest[i] = binary.LittleEndian.Uint32(src[i*4:])
|
||||||
|
|
|
||||||
|
|
@ -267,6 +267,7 @@ func (err compileError) Error() string {
|
||||||
return fmt.Sprintf("%d syntax error: unexpected %v, expected %v", err.lineno, err.got, err.want)
|
return fmt.Sprintf("%d syntax error: unexpected %v, expected %v", err.lineno, err.got, err.want)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
var (
|
var (
|
||||||
errExpBol = errors.New("expected beginning of line")
|
errExpBol = errors.New("expected beginning of line")
|
||||||
errExpElementOrLabel = errors.New("expected beginning of line")
|
errExpElementOrLabel = errors.New("expected beginning of line")
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// So we can deterministically seed different blockchains
|
// So we can deterministically seed different blockchains
|
||||||
|
// nolint: deadcode
|
||||||
var (
|
var (
|
||||||
canonicalSeed = 1
|
canonicalSeed = 1
|
||||||
forkSeed = 2
|
forkSeed = 2
|
||||||
|
|
@ -229,6 +230,7 @@ func makeHeader(config *params.ChainConfig, parent *types.Block, state *state.St
|
||||||
// newCanonical creates a chain database, and injects a deterministic canonical
|
// newCanonical creates a chain database, and injects a deterministic canonical
|
||||||
// chain. Depending on the full flag, if creates either a full block chain or a
|
// chain. Depending on the full flag, if creates either a full block chain or a
|
||||||
// header only chain.
|
// header only chain.
|
||||||
|
// nolint: deadcode
|
||||||
func newCanonical(n int, full bool) (ethdb.Database, *BlockChain, error) {
|
func newCanonical(n int, full bool) (ethdb.Database, *BlockChain, error) {
|
||||||
// Initialize a fresh chain with only a genesis block
|
// Initialize a fresh chain with only a genesis block
|
||||||
gspec := new(Genesis)
|
gspec := new(Genesis)
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ type GenesisAccount struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// field type overrides for gencodec
|
// field type overrides for gencodec
|
||||||
|
// nolint: deadcode
|
||||||
type genesisSpecMarshaling struct {
|
type genesisSpecMarshaling struct {
|
||||||
Nonce math.HexOrDecimal64
|
Nonce math.HexOrDecimal64
|
||||||
Timestamp math.HexOrDecimal64
|
Timestamp math.HexOrDecimal64
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ import (
|
||||||
"gopkg.in/karalabe/cookiejar.v2/collections/prque"
|
"gopkg.in/karalabe/cookiejar.v2/collections/prque"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
// chainHeadChanSize is the size of channel listening to ChainHeadEvent.
|
// chainHeadChanSize is the size of channel listening to ChainHeadEvent.
|
||||||
chainHeadChanSize = 10
|
chainHeadChanSize = 10
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ type Header struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// field type overrides for gencodec
|
// field type overrides for gencodec
|
||||||
|
// nolint: deadcode
|
||||||
type headerMarshaling struct {
|
type headerMarshaling struct {
|
||||||
Difficulty *hexutil.Big
|
Difficulty *hexutil.Big
|
||||||
Number *hexutil.Big
|
Number *hexutil.Big
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ type Log struct {
|
||||||
Removed bool `json:"removed"`
|
Removed bool `json:"removed"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
type logMarshaling struct {
|
type logMarshaling struct {
|
||||||
Data hexutil.Bytes
|
Data hexutil.Bytes
|
||||||
BlockNumber hexutil.Uint64
|
BlockNumber hexutil.Uint64
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ type Receipt struct {
|
||||||
GasUsed *big.Int `json:"gasUsed" gencodec:"required"`
|
GasUsed *big.Int `json:"gasUsed" gencodec:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
type receiptMarshaling struct {
|
type receiptMarshaling struct {
|
||||||
PostState hexutil.Bytes
|
PostState hexutil.Bytes
|
||||||
Status hexutil.Uint
|
Status hexutil.Uint
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import (
|
||||||
|
|
||||||
//go:generate gencodec -type txdata -field-override txdataMarshaling -out gen_tx_json.go
|
//go:generate gencodec -type txdata -field-override txdataMarshaling -out gen_tx_json.go
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
var (
|
var (
|
||||||
ErrInvalidSig = errors.New("invalid transaction v, r, s values")
|
ErrInvalidSig = errors.New("invalid transaction v, r, s values")
|
||||||
errNoSigner = errors.New("missing signing methods")
|
errNoSigner = errors.New("missing signing methods")
|
||||||
|
|
@ -71,6 +72,7 @@ type txdata struct {
|
||||||
Hash *common.Hash `json:"hash" rlp:"-"`
|
Hash *common.Hash `json:"hash" rlp:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
type txdataMarshaling struct {
|
type txdataMarshaling struct {
|
||||||
AccountNonce hexutil.Uint64
|
AccountNonce hexutil.Uint64
|
||||||
Price *hexutil.Big
|
Price *hexutil.Big
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ type StructLog struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// overrides for gencodec
|
// overrides for gencodec
|
||||||
|
// nolint: deadcode
|
||||||
type structLogMarshaling struct {
|
type structLogMarshaling struct {
|
||||||
Stack []*math.HexOrDecimal256
|
Stack []*math.HexOrDecimal256
|
||||||
Gas math.HexOrDecimal64
|
Gas math.HexOrDecimal64
|
||||||
|
|
|
||||||
|
|
@ -65,12 +65,6 @@ func memoryCall(stack *Stack) *big.Int {
|
||||||
return math.BigMax(x, y)
|
return math.BigMax(x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
func memoryCallCode(stack *Stack) *big.Int {
|
|
||||||
x := calcMemSize(stack.Back(5), stack.Back(6))
|
|
||||||
y := calcMemSize(stack.Back(3), stack.Back(4))
|
|
||||||
|
|
||||||
return math.BigMax(x, y)
|
|
||||||
}
|
|
||||||
func memoryDelegateCall(stack *Stack) *big.Int {
|
func memoryDelegateCall(stack *Stack) *big.Int {
|
||||||
x := calcMemSize(stack.Back(4), stack.Back(5))
|
x := calcMemSize(stack.Back(4), stack.Back(5))
|
||||||
y := calcMemSize(stack.Back(2), stack.Back(3))
|
y := calcMemSize(stack.Back(2), stack.Back(3))
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,5 @@ var (
|
||||||
copyOutUnaligned = copyOutGeneric
|
copyOutUnaligned = copyOutGeneric
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const xorImplementationUnaligned = "generic"
|
const xorImplementationUnaligned = "generic"
|
||||||
|
|
|
||||||
|
|
@ -55,4 +55,5 @@ var (
|
||||||
copyOut = copyOutUnaligned
|
copyOut = copyOutUnaligned
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const xorImplementationUnaligned = "unaligned"
|
const xorImplementationUnaligned = "unaligned"
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,7 @@ type Config struct {
|
||||||
PowShared bool `toml:"-"`
|
PowShared bool `toml:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
type configMarshaling struct {
|
type configMarshaling struct {
|
||||||
ExtraData hexutil.Bytes
|
ExtraData hexutil.Bytes
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ var (
|
||||||
fsCriticalTrials = uint32(32) // Number of times to retry in the cricical section before bailing
|
fsCriticalTrials = uint32(32) // Number of times to retry in the cricical section before bailing
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
var (
|
var (
|
||||||
errBusy = errors.New("busy")
|
errBusy = errors.New("busy")
|
||||||
errUnknownPeer = errors.New("peer is unknown or unhealthy")
|
errUnknownPeer = errors.New("peer is unknown or unhealthy")
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ func (eth *LightEthereum) startBloomHandlers() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
// bloomConfirms is the number of confirmation blocks before a bloom section is
|
// bloomConfirms is the number of confirmation blocks before a bloom section is
|
||||||
// considered probably final and its rotated bits are calculated.
|
// considered probably final and its rotated bits are calculated.
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
// After a connection has been ended or timed out, there is a waiting period
|
// After a connection has been ended or timed out, there is a waiting period
|
||||||
// before it can be selected for connection again.
|
// before it can be selected for connection again.
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/light"
|
"github.com/ethereum/go-ethereum/light"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
//forceSyncCycle = 10 * time.Second // Time interval to force syncs, even if few peers are available
|
//forceSyncCycle = 10 * time.Second // Time interval to force syncs, even if few peers are available
|
||||||
minDesiredPeerCount = 5 // Amount of peers desired to start syncing
|
minDesiredPeerCount = 5 // Amount of peers desired to start syncing
|
||||||
|
|
|
||||||
|
|
@ -412,6 +412,7 @@ func logdist(a, b common.Hash) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// hashAtDistance returns a random hash such that logdist(a, b) == n
|
// hashAtDistance returns a random hash such that logdist(a, b) == n
|
||||||
|
// nolint: deadcode
|
||||||
func hashAtDistance(a common.Hash, n int) (b common.Hash) {
|
func hashAtDistance(a common.Hash, n int) (b common.Hash) {
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
return a
|
return a
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Timeouts
|
// Timeouts
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
respTimeout = 500 * time.Millisecond
|
respTimeout = 500 * time.Millisecond
|
||||||
sendTimeout = 500 * time.Millisecond
|
sendTimeout = 500 * time.Millisecond
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
var (
|
var (
|
||||||
errInvalidEvent = errors.New("invalid in current state")
|
errInvalidEvent = errors.New("invalid in current state")
|
||||||
errNoQuery = errors.New("no pending query")
|
errNoQuery = errors.New("no pending query")
|
||||||
|
|
@ -48,6 +49,7 @@ const (
|
||||||
lowPort = 1024
|
lowPort = 1024
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const testTopic = "foo"
|
const testTopic = "foo"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -825,12 +827,11 @@ type nodeEvent uint
|
||||||
|
|
||||||
//go:generate stringer -type=nodeEvent
|
//go:generate stringer -type=nodeEvent
|
||||||
|
|
||||||
|
//
|
||||||
const (
|
const (
|
||||||
invalidEvent nodeEvent = iota // zero is reserved
|
|
||||||
|
|
||||||
// Packet type events.
|
// Packet type events.
|
||||||
// These correspond to packet types in the UDP protocol.
|
// These correspond to packet types in the UDP protocol.
|
||||||
pingPacket
|
pingPacket nodeEvent = iota + 1
|
||||||
pongPacket
|
pongPacket
|
||||||
findnodePacket
|
findnodePacket
|
||||||
neighborsPacket
|
neighborsPacket
|
||||||
|
|
|
||||||
|
|
@ -413,6 +413,7 @@ func logdist(a, b common.Hash) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// hashAtDistance returns a random hash such that logdist(a, b) == n
|
// hashAtDistance returns a random hash such that logdist(a, b) == n
|
||||||
|
// nolint: deadcode
|
||||||
func hashAtDistance(a common.Hash, n int) (b common.Hash) {
|
func hashAtDistance(a common.Hash, n int) (b common.Hash) {
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
return a
|
return a
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,26 @@
|
||||||
// Code generated by "stringer -type nodeEvent"; DO NOT EDIT
|
// Code generated by "stringer -type=nodeEvent"; DO NOT EDIT.
|
||||||
|
|
||||||
package discv5
|
package discv5
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_nodeEvent_name_0 = "invalidEventpingPacketpongPacketfindnodePacketneighborsPacketfindnodeHashPackettopicRegisterPackettopicQueryPackettopicNodesPacket"
|
_nodeEvent_name_0 = "pingPacketpongPacketfindnodePacketneighborsPacketfindnodeHashPackettopicRegisterPackettopicQueryPackettopicNodesPacket"
|
||||||
_nodeEvent_name_1 = "pongTimeoutpingTimeoutneighboursTimeout"
|
_nodeEvent_name_1 = "pongTimeoutpingTimeoutneighboursTimeout"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_nodeEvent_index_0 = [...]uint8{0, 12, 22, 32, 46, 61, 79, 98, 114, 130}
|
_nodeEvent_index_0 = [...]uint8{0, 10, 20, 34, 49, 67, 86, 102, 118}
|
||||||
_nodeEvent_index_1 = [...]uint8{0, 11, 22, 39}
|
_nodeEvent_index_1 = [...]uint8{0, 11, 22, 39}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (i nodeEvent) String() string {
|
func (i nodeEvent) String() string {
|
||||||
switch {
|
switch {
|
||||||
case 0 <= i && i <= 8:
|
case 1 <= i && i <= 8:
|
||||||
|
i -= 1
|
||||||
return _nodeEvent_name_0[_nodeEvent_index_0[i]:_nodeEvent_index_0[i+1]]
|
return _nodeEvent_name_0[_nodeEvent_index_0[i]:_nodeEvent_index_0[i+1]]
|
||||||
case 265 <= i && i <= 267:
|
case 264 <= i && i <= 266:
|
||||||
i -= 265
|
i -= 264
|
||||||
return _nodeEvent_name_1[_nodeEvent_index_1[i]:_nodeEvent_index_1[i+1]]
|
return _nodeEvent_name_1[_nodeEvent_index_1[i]:_nodeEvent_index_1[i+1]]
|
||||||
default:
|
default:
|
||||||
return fmt.Sprintf("nodeEvent(%d)", i)
|
return fmt.Sprintf("nodeEvent(%d)", i)
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ func (s durationSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||||
|
|
||||||
// checkClockDrift queries an NTP server for clock drifts and warns the user if
|
// checkClockDrift queries an NTP server for clock drifts and warns the user if
|
||||||
// one large enough is detected.
|
// one large enough is detected.
|
||||||
|
// nolint: deadcode
|
||||||
func checkClockDrift() {
|
func checkClockDrift() {
|
||||||
drift, err := sntpDrift(ntpChecks)
|
drift, err := sntpDrift(ntpChecks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
alpha = 3 // Kademlia concurrency factor
|
alpha = 3 // Kademlia concurrency factor
|
||||||
bucketSize = 16 // Kademlia bucket size
|
bucketSize = 16 // Kademlia bucket size
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ import (
|
||||||
const Version = 4
|
const Version = 4
|
||||||
|
|
||||||
// Errors
|
// Errors
|
||||||
|
// nolint: deadcode
|
||||||
var (
|
var (
|
||||||
errPacketTooSmall = errors.New("too small")
|
errPacketTooSmall = errors.New("too small")
|
||||||
errBadHash = errors.New("bad hash")
|
errBadHash = errors.New("bad hash")
|
||||||
|
|
@ -47,6 +48,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Timeouts
|
// Timeouts
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
respTimeout = 500 * time.Millisecond
|
respTimeout = 500 * time.Millisecond
|
||||||
sendTimeout = 500 * time.Millisecond
|
sendTimeout = 500 * time.Millisecond
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,7 @@ func SendItems(w MsgWriter, msgcode uint64, elems ...interface{}) error {
|
||||||
|
|
||||||
// netWrapper wraps a MsgReadWriter with locks around
|
// netWrapper wraps a MsgReadWriter with locks around
|
||||||
// ReadMsg/WriteMsg and applies read/write deadlines.
|
// ReadMsg/WriteMsg and applies read/write deadlines.
|
||||||
|
// nolint: deadcode
|
||||||
type netWrapper struct {
|
type netWrapper struct {
|
||||||
rmu, wmu sync.Mutex
|
rmu, wmu sync.Mutex
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ const (
|
||||||
pingInterval = 15 * time.Second
|
pingInterval = 15 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
// devp2p message codes
|
// devp2p message codes
|
||||||
handshakeMsg = 0x00
|
handshakeMsg = 0x00
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/p2p/netutil"
|
"github.com/ethereum/go-ethereum/p2p/netutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
defaultDialTimeout = 15 * time.Second
|
defaultDialTimeout = 15 * time.Second
|
||||||
refreshPeersInterval = 30 * time.Second
|
refreshPeersInterval = 30 * time.Second
|
||||||
|
|
|
||||||
|
|
@ -307,6 +307,7 @@ type nodesByDistance struct {
|
||||||
target Address
|
target Address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
func sortedByDistanceTo(target Address, slice []Node) bool {
|
func sortedByDistanceTo(target Address, slice []Node) bool {
|
||||||
var last Address
|
var last Address
|
||||||
for i, node := range slice {
|
for i, node := range slice {
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ import (
|
||||||
"github.com/syndtr/goleveldb/leveldb/iterator"
|
"github.com/syndtr/goleveldb/leveldb/iterator"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
defaultDbCapacity = 5000000
|
defaultDbCapacity = 5000000
|
||||||
defaultRadius = 0 // not yet used
|
defaultRadius = 0 // not yet used
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ func NewNetStore(hash SwarmHasher, lstore *LocalStore, cloud CloudStore, params
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint: deadcode
|
||||||
const (
|
const (
|
||||||
// maximum number of peers that a retrieved message is delivered to
|
// maximum number of peers that a retrieved message is delivered to
|
||||||
requesterCount = 3
|
requesterCount = 3
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ func newTopicMatcher(topics ...[]Topic) *topicMatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
// newTopicMatcherFromBinary create a topic matcher from a list of binary conditions.
|
// newTopicMatcherFromBinary create a topic matcher from a list of binary conditions.
|
||||||
|
// nolint: deadcode
|
||||||
func newTopicMatcherFromBinary(data ...[][]byte) *topicMatcher {
|
func newTopicMatcherFromBinary(data ...[][]byte) *topicMatcher {
|
||||||
topics := make([][]Topic, len(data))
|
topics := make([][]Topic, len(data))
|
||||||
for i, condition := range data {
|
for i, condition := range data {
|
||||||
|
|
@ -114,6 +115,7 @@ func newTopicMatcherFromBinary(data ...[][]byte) *topicMatcher {
|
||||||
|
|
||||||
// newTopicMatcherFromStrings creates a topic matcher from a list of textual
|
// newTopicMatcherFromStrings creates a topic matcher from a list of textual
|
||||||
// conditions.
|
// conditions.
|
||||||
|
// nolint: deadcode
|
||||||
func newTopicMatcherFromStrings(data ...[]string) *topicMatcher {
|
func newTopicMatcherFromStrings(data ...[]string) *topicMatcher {
|
||||||
topics := make([][]Topic, len(data))
|
topics := make([][]Topic, len(data))
|
||||||
for i, condition := range data {
|
for i, condition := range data {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue