diff options
author | Egon Elbre <egonelbre@gmail.com> | 2017-08-08 19:48:06 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-08-08 19:48:06 +0800 |
commit | d375193797e8198a82c6a1796064ffb289c6956e (patch) | |
tree | e725c3f2b03367933e4832bb603458b0c9bce500 /whisper/whisperv5 | |
parent | 374c49e0ac0f636eb37a31833f91f28ad1859750 (diff) | |
download | go-tangerine-d375193797e8198a82c6a1796064ffb289c6956e.tar.gz go-tangerine-d375193797e8198a82c6a1796064ffb289c6956e.tar.zst go-tangerine-d375193797e8198a82c6a1796064ffb289c6956e.zip |
whisper: fix megacheck warnings (#14925)
* whisper: fix megacheck warnings
* whisper/whisperv5: regenerate json codec to fix unused override type
Diffstat (limited to 'whisper/whisperv5')
-rw-r--r-- | whisper/whisperv5/gen_criteria_json.go | 2 | ||||
-rw-r--r-- | whisper/whisperv5/gen_message_json.go | 2 | ||||
-rw-r--r-- | whisper/whisperv5/gen_newmessage_json.go | 2 | ||||
-rw-r--r-- | whisper/whisperv5/message_test.go | 7 | ||||
-rw-r--r-- | whisper/whisperv5/whisper_test.go | 8 |
5 files changed, 14 insertions, 7 deletions
diff --git a/whisper/whisperv5/gen_criteria_json.go b/whisper/whisperv5/gen_criteria_json.go index 8d3e9ee24..df0de85df 100644 --- a/whisper/whisperv5/gen_criteria_json.go +++ b/whisper/whisperv5/gen_criteria_json.go @@ -8,6 +8,8 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ) +var _ = (*criteriaOverride)(nil) + func (c Criteria) MarshalJSON() ([]byte, error) { type Criteria struct { SymKeyID string `json:"symKeyID"` diff --git a/whisper/whisperv5/gen_message_json.go b/whisper/whisperv5/gen_message_json.go index 26168225c..185557331 100644 --- a/whisper/whisperv5/gen_message_json.go +++ b/whisper/whisperv5/gen_message_json.go @@ -8,6 +8,8 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ) +var _ = (*messageOverride)(nil) + func (m Message) MarshalJSON() ([]byte, error) { type Message struct { Sig hexutil.Bytes `json:"sig,omitempty"` diff --git a/whisper/whisperv5/gen_newmessage_json.go b/whisper/whisperv5/gen_newmessage_json.go index 0231cd919..d0a47185e 100644 --- a/whisper/whisperv5/gen_newmessage_json.go +++ b/whisper/whisperv5/gen_newmessage_json.go @@ -8,6 +8,8 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ) +var _ = (*newMessageOverride)(nil) + func (n NewMessage) MarshalJSON() ([]byte, error) { type NewMessage struct { SymKeyID string `json:"symKeyID"` diff --git a/whisper/whisperv5/message_test.go b/whisper/whisperv5/message_test.go index aa82a02f3..2edf945df 100644 --- a/whisper/whisperv5/message_test.go +++ b/whisper/whisperv5/message_test.go @@ -25,11 +25,6 @@ import ( "github.com/ethereum/go-ethereum/rlp" ) -func copyFromBuf(dst []byte, src []byte, beg int) int { - copy(dst, src[beg:]) - return beg + len(dst) -} - func generateMessageParams() (*MessageParams, error) { // set all the parameters except p.Dst and p.Padding @@ -158,7 +153,7 @@ func TestMessageWrap(t *testing.T) { params.TTL = 1000000 params.WorkTime = 1 params.PoW = 10000000.0 - env, err = msg2.Wrap(params) + _, err = msg2.Wrap(params) if err == nil { t.Fatalf("unexpectedly reached the PoW target with seed %d.", seed) } diff --git a/whisper/whisperv5/whisper_test.go b/whisper/whisperv5/whisper_test.go index 145143833..025be5b54 100644 --- a/whisper/whisperv5/whisper_test.go +++ b/whisper/whisperv5/whisper_test.go @@ -424,7 +424,7 @@ func TestWhisperSymKeyManagement(t *testing.T) { randomKey = make([]byte, aesKeyLength+1) mrand.Read(randomKey) - id1, err = w.AddSymKeyDirect(randomKey) + _, err = w.AddSymKeyDirect(randomKey) if err == nil { t.Fatalf("added the key with wrong size, seed %d.", seed) } @@ -541,6 +541,9 @@ func TestCustomization(t *testing.T) { const smallPoW = 0.00001 f, err := generateFilter(t, true) + if err != nil { + t.Fatalf("failed generateMessageParams with seed %d: %s.", seed, err) + } params, err := generateMessageParams() if err != nil { t.Fatalf("failed generateMessageParams with seed %d: %s.", seed, err) @@ -607,6 +610,9 @@ func TestCustomization(t *testing.T) { // check w.messages() id, err := w.Subscribe(f) + if err != nil { + t.Fatalf("failed subscribe with seed %d: %s.", seed, err) + } time.Sleep(5 * time.Millisecond) mail := f.Retrieve() if len(mail) > 0 { |