mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
whisper/mailserver: remove unnecessary uses of fmt.Sprintf
This commit is contained in:
parent
6254c4fb56
commit
1f1dcd603d
1 changed files with 4 additions and 4 deletions
|
|
@ -169,7 +169,7 @@ func (s *WMailServer) validateRequest(peerID []byte, request *whisper.Envelope)
|
||||||
f := whisper.Filter{KeySym: s.key}
|
f := whisper.Filter{KeySym: s.key}
|
||||||
decrypted := request.Open(&f)
|
decrypted := request.Open(&f)
|
||||||
if decrypted == nil {
|
if decrypted == nil {
|
||||||
log.Warn(fmt.Sprintf("Failed to decrypt p2p request"))
|
log.Warn("Failed to decrypt p2p request")
|
||||||
return false, 0, 0, nil
|
return false, 0, 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -181,19 +181,19 @@ func (s *WMailServer) validateRequest(peerID []byte, request *whisper.Envelope)
|
||||||
// if you want to check the signature, you can do it here. e.g.:
|
// if you want to check the signature, you can do it here. e.g.:
|
||||||
// if !bytes.Equal(peerID, src) {
|
// if !bytes.Equal(peerID, src) {
|
||||||
if src == nil {
|
if src == nil {
|
||||||
log.Warn(fmt.Sprintf("Wrong signature of p2p request"))
|
log.Warn("Wrong signature of p2p request")
|
||||||
return false, 0, 0, nil
|
return false, 0, 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var bloom []byte
|
var bloom []byte
|
||||||
payloadSize := len(decrypted.Payload)
|
payloadSize := len(decrypted.Payload)
|
||||||
if payloadSize < 8 {
|
if payloadSize < 8 {
|
||||||
log.Warn(fmt.Sprintf("Undersized p2p request"))
|
log.Warn("Undersized p2p request")
|
||||||
return false, 0, 0, nil
|
return false, 0, 0, nil
|
||||||
} else if payloadSize == 8 {
|
} else if payloadSize == 8 {
|
||||||
bloom = whisper.MakeFullNodeBloom()
|
bloom = whisper.MakeFullNodeBloom()
|
||||||
} else if payloadSize < 8+whisper.BloomFilterSize {
|
} else if payloadSize < 8+whisper.BloomFilterSize {
|
||||||
log.Warn(fmt.Sprintf("Undersized bloom filter in p2p request"))
|
log.Warn("Undersized bloom filter in p2p request")
|
||||||
return false, 0, 0, nil
|
return false, 0, 0, nil
|
||||||
} else {
|
} else {
|
||||||
bloom = decrypted.Payload[8 : 8+whisper.BloomFilterSize]
|
bloom = decrypted.Payload[8 : 8+whisper.BloomFilterSize]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue