mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/puppeth/wizard_genesis.go,eth/handler.go,les/benchmark.go,les/handler.go,metrics/exp/exp.go,signer/core/api.go,swarm/api/client/client.go,swarm/network/stream/snapshot_sync_test.go,swarm/network/stream/stream.go,swarm/pss/pss.go,swarm/storage/feed/lookup/lookup.go,swarm/storage/hasherstore.go,whisper/whisperv6/envelope.go,whisper/whisperv6/message.go,whisper/whisperv6/peer_test.go: Removed redundant parentheses
This commit is contained in:
parent
fb458280d1
commit
53493e34e5
15 changed files with 18 additions and 18 deletions
|
|
@ -249,7 +249,7 @@ func (w *wizard) manageGenesis() {
|
|||
|
||||
// Export the native genesis spec used by puppeth and Geth
|
||||
gethJson := filepath.Join(folder, fmt.Sprintf("%s.json", w.network))
|
||||
if err := ioutil.WriteFile((gethJson), out, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(gethJson, out, 0644); err != nil {
|
||||
log.Error("Failed to save genesis file", "err", err)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
|
|||
unknown = true
|
||||
} else {
|
||||
query.Origin.Hash, query.Origin.Number = pm.blockchain.GetAncestor(query.Origin.Hash, query.Origin.Number, ancestor, &maxNonCanonical)
|
||||
unknown = (query.Origin.Hash == common.Hash{})
|
||||
unknown = query.Origin.Hash == common.Hash{}
|
||||
}
|
||||
case hashMode && !query.Reverse:
|
||||
// Hash based traversal towards the leaf block
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ func (b *benchmarkHelperTrie) init(pm *ProtocolManager, count int) error {
|
|||
b.sectionCount, b.headNum, _ = pm.server.bloomTrieIndexer.Sections()
|
||||
} else {
|
||||
b.sectionCount, _, _ = pm.server.chtIndexer.Sections()
|
||||
b.sectionCount /= (params.CHTFrequencyClient / params.CHTFrequencyServer)
|
||||
b.sectionCount /= params.CHTFrequencyClient / params.CHTFrequencyServer
|
||||
b.headNum = b.sectionCount*params.CHTFrequencyClient - 1
|
||||
}
|
||||
if b.sectionCount == 0 {
|
||||
|
|
|
|||
|
|
@ -493,7 +493,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
|
|||
unknown = true
|
||||
} else {
|
||||
query.Origin.Hash, query.Origin.Number = pm.blockchain.GetAncestor(query.Origin.Hash, query.Origin.Number, ancestor, &maxNonCanonical)
|
||||
unknown = (query.Origin.Hash == common.Hash{})
|
||||
unknown = query.Origin.Hash == common.Hash{}
|
||||
}
|
||||
case hashMode && !query.Reverse:
|
||||
// Hash based traversal towards the leaf block
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ func (exp *exp) publishMeter(name string, metric metrics.Meter) {
|
|||
exp.getInt(name + ".count").Set(m.Count())
|
||||
exp.getFloat(name + ".one-minute").Set(m.Rate1())
|
||||
exp.getFloat(name + ".five-minute").Set(m.Rate5())
|
||||
exp.getFloat(name + ".fifteen-minute").Set((m.Rate15()))
|
||||
exp.getFloat(name + ".fifteen-minute").Set(m.Rate15())
|
||||
exp.getFloat(name + ".mean").Set(m.RateMean())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ func (api *SignerAPI) New(ctx context.Context) (common.Address, error) {
|
|||
continue
|
||||
}
|
||||
if pwErr := ValidatePasswordFormat(resp.Text); pwErr != nil {
|
||||
api.UI.ShowError(fmt.Sprintf("Account creation attempt #%d failed due to password requirements: %v", (i + 1), pwErr))
|
||||
api.UI.ShowError(fmt.Sprintf("Account creation attempt #%d failed due to password requirements: %v", i + 1, pwErr))
|
||||
} else {
|
||||
// No error
|
||||
acc, err := be[0].(*keystore.KeyStore).NewAccount(resp.Text)
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ func (c *Client) DownloadRaw(hash string) (io.ReadCloser, bool, error) {
|
|||
res.Body.Close()
|
||||
return nil, false, fmt.Errorf("unexpected HTTP status: %s", res.Status)
|
||||
}
|
||||
isEncrypted := (res.Header.Get("X-Decrypted") == "true")
|
||||
isEncrypted := res.Header.Get("X-Decrypted") == "true"
|
||||
return res.Body, isEncrypted, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ func uploadFileToSingleNodeStore(id enode.ID, chunkCount int, lstore *storage.Lo
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rootAddrs = append(rootAddrs, (rk))
|
||||
rootAddrs = append(rootAddrs, rk)
|
||||
}
|
||||
|
||||
return rootAddrs, nil
|
||||
|
|
|
|||
|
|
@ -629,11 +629,11 @@ func (p *Peer) HandleMsg(ctx context.Context, msg interface{}) error {
|
|||
|
||||
case *ChunkDeliveryMsgRetrieval:
|
||||
// handling chunk delivery is the same for retrieval and syncing, so let's cast the msg
|
||||
return p.streamer.delivery.handleChunkDeliveryMsg(ctx, p, ((*ChunkDeliveryMsg)(msg)))
|
||||
return p.streamer.delivery.handleChunkDeliveryMsg(ctx, p, (*ChunkDeliveryMsg)(msg))
|
||||
|
||||
case *ChunkDeliveryMsgSyncing:
|
||||
// handling chunk delivery is the same for retrieval and syncing, so let's cast the msg
|
||||
return p.streamer.delivery.handleChunkDeliveryMsg(ctx, p, ((*ChunkDeliveryMsg)(msg)))
|
||||
return p.streamer.delivery.handleChunkDeliveryMsg(ctx, p, (*ChunkDeliveryMsg)(msg))
|
||||
|
||||
case *RetrieveRequestMsg:
|
||||
return p.streamer.delivery.handleRetrieveRequestMsg(ctx, p, msg)
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ func (p *Pss) handlePssMsg(ctx context.Context, msg interface{}) error {
|
|||
return nil
|
||||
}
|
||||
if p.checkFwdCache(pssmsg) {
|
||||
log.Trace("pss relay block-cache match (process)", "from", common.ToHex(p.Kademlia.BaseAddr()), "to", (common.ToHex(pssmsg.To)))
|
||||
log.Trace("pss relay block-cache match (process)", "from", common.ToHex(p.Kademlia.BaseAddr()), "to", common.ToHex(pssmsg.To))
|
||||
return nil
|
||||
}
|
||||
p.addFwdCache(pssmsg)
|
||||
|
|
|
|||
|
|
@ -75,12 +75,12 @@ func Hint(last uint64) Epoch {
|
|||
func GetNextLevel(last Epoch, now uint64) uint8 {
|
||||
// First XOR the last epoch base time with the current clock.
|
||||
// This will set all the common most significant bits to zero.
|
||||
mix := (last.Base() ^ now)
|
||||
mix := last.Base() ^ now
|
||||
|
||||
// Then, make sure we stop the below loop before one level below the current, by setting
|
||||
// that level's bit to 1.
|
||||
// If the next level is lower than the current one, it must be exactly level-1 and not lower.
|
||||
mix |= (1 << (last.Level - 1))
|
||||
mix |= 1 << (last.Level - 1)
|
||||
|
||||
// if the last update was more than 2^highestLevel seconds ago, choose the highest level
|
||||
if mix > (maxuint64 >> (64 - HighestLevel - 1)) {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ func (h *hasherStore) Get(ctx context.Context, ref Reference) (ChunkData, error)
|
|||
}
|
||||
|
||||
chunkData := ChunkData(chunk.Data())
|
||||
toDecrypt := (encryptionKey != nil)
|
||||
toDecrypt := encryptionKey != nil
|
||||
if toDecrypt {
|
||||
var err error
|
||||
chunkData, err = h.decryptChunkData(chunkData, encryptionKey)
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ func TopicToBloom(topic TopicType) []byte {
|
|||
for j := 0; j < 3; j++ {
|
||||
byteIndex := index[j] / 8
|
||||
bitIndex := index[j] % 8
|
||||
b[byteIndex] = (1 << uint(bitIndex))
|
||||
b[byteIndex] = 1 << uint(bitIndex)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ func (msg *sentMessage) sign(key *ecdsa.PrivateKey) error {
|
|||
hash := crypto.Keccak256(msg.Raw)
|
||||
signature, err := crypto.Sign(hash, key)
|
||||
if err != nil {
|
||||
msg.Raw[0] &= (0xFF ^ signatureFlag) // clear the flag
|
||||
msg.Raw[0] &= 0xFF ^ signatureFlag // clear the flag
|
||||
return err
|
||||
}
|
||||
msg.Raw = append(msg.Raw, signature...)
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ func TestPeerBasic(t *testing.T) {
|
|||
func checkPowExchangeForNodeZero(t *testing.T) {
|
||||
const iterations = 200
|
||||
for j := 0; j < iterations; j++ {
|
||||
lastCycle := (j == iterations-1)
|
||||
lastCycle := j == iterations-1
|
||||
ok := checkPowExchangeForNodeZeroOnce(t, lastCycle)
|
||||
if ok {
|
||||
break
|
||||
|
|
@ -485,7 +485,7 @@ func checkBloomFilterExchangeOnce(t *testing.T, mustPass bool) bool {
|
|||
func checkBloomFilterExchange(t *testing.T) {
|
||||
const iterations = 200
|
||||
for j := 0; j < iterations; j++ {
|
||||
lastCycle := (j == iterations-1)
|
||||
lastCycle := j == iterations-1
|
||||
ok := checkBloomFilterExchangeOnce(t, lastCycle)
|
||||
if ok {
|
||||
break
|
||||
|
|
|
|||
Loading…
Reference in a new issue