From aef7580bea1d42c048fdf493accf10c62211ccc1 Mon Sep 17 00:00:00 2001 From: Vlad Date: Fri, 22 Dec 2017 19:11:36 +0200 Subject: [PATCH] whisper: bloom filter logic introduced --- whisper/whisperv6/api.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/whisper/whisperv6/api.go b/whisper/whisperv6/api.go index 0e8490b419..f11e8b6dca 100644 --- a/whisper/whisperv6/api.go +++ b/whisper/whisperv6/api.go @@ -113,17 +113,29 @@ func (api *PublicWhisperAPI) Info(ctx context.Context) Info { // SetMaxMessageSize sets the maximum message size that is accepted. // Upper limit is defined by MaxMessageSize. func (api *PublicWhisperAPI) SetMaxMessageSize(ctx context.Context, size uint32) (bool, error) { - return true, api.w.SetMaxMessageSize(size) + err := api.w.SetMaxMessageSize(size) + if err != nil { + return false, err + } + return true, nil } // SetMinPow sets the minimum PoW, and notifies the peers. func (api *PublicWhisperAPI) SetMinPoW(ctx context.Context, pow float64) (bool, error) { - return true, api.w.SetMinimumPoW(pow) + err := 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. func (api *PublicWhisperAPI) SetBloomFilter(ctx context.Context, bloom hexutil.Bytes) (bool, error) { - return true, api.w.SetBloomFilter(bloom) + err := 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.