whisper: minor refactoring

This commit is contained in:
Vlad 2018-01-09 13:39:36 +02:00 committed by Guillaume Ballet
parent 9f26907196
commit bb7b29c362
2 changed files with 3 additions and 24 deletions

View file

@ -113,29 +113,17 @@ func (api *PublicWhisperAPI) Info(ctx context.Context) Info {
// SetMaxMessageSize sets the maximum message size that is accepted. // SetMaxMessageSize sets the maximum message size that is accepted.
// Upper limit is defined by MaxMessageSize. // Upper limit is defined by MaxMessageSize.
func (api *PublicWhisperAPI) SetMaxMessageSize(ctx context.Context, size uint32) (bool, error) { func (api *PublicWhisperAPI) SetMaxMessageSize(ctx context.Context, size uint32) (bool, error) {
err := api.w.SetMaxMessageSize(size) return true, api.w.SetMaxMessageSize(size)
if err != nil {
return false, err
}
return true, nil
} }
// SetMinPow sets the minimum PoW, and notifies the peers. // SetMinPow sets the minimum PoW, and notifies the peers.
func (api *PublicWhisperAPI) SetMinPoW(ctx context.Context, pow float64) (bool, error) { func (api *PublicWhisperAPI) SetMinPoW(ctx context.Context, pow float64) (bool, error) {
err := api.w.SetMinimumPoW(pow) return true, api.w.SetMinimumPoW(pow)
if err != nil {
return false, err
}
return true, nil
} }
// SetBloomFilter sets the new value of bloom filter, and notifies the peers. // SetBloomFilter sets the new value of bloom filter, and notifies the peers.
func (api *PublicWhisperAPI) SetBloomFilter(ctx context.Context, bloom hexutil.Bytes) (bool, error) { func (api *PublicWhisperAPI) SetBloomFilter(ctx context.Context, bloom hexutil.Bytes) (bool, error) {
err := api.w.SetBloomFilter(bloom) return true, api.w.SetBloomFilter(bloom)
if err != nil {
return false, err
}
return true, nil
} }
// MarkTrustedPeer marks a peer trusted, which will allow it to send historic (expired) messages. // MarkTrustedPeer marks a peer trusted, which will allow it to send historic (expired) messages.

View file

@ -1067,12 +1067,3 @@ func addBloom(a, b []byte) []byte {
} }
return c return c
} }
func isBloomFilterEqual(a, b []byte) bool {
for i := 0; i < bloomFilterSize; i++ {
if a[i] != b[i] {
return false
}
}
return true
}