Skip to content

Commit 5183483

Browse files
mueslikaralabe
authored andcommitted
core/state, p2p/discover, trie, whisper: avoid unnecessary conversions (#19870)
No need to convert these types.
1 parent a1f8549 commit 5183483

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

core/state/statedb_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ func TestIntermediateLeaks(t *testing.T) {
8686

8787
// Modify the transient state.
8888
for i := byte(0); i < 255; i++ {
89-
modify(transState, common.Address{byte(i)}, i, 0)
89+
modify(transState, common.Address{i}, i, 0)
9090
}
9191
// Write modifications to trie.
9292
transState.IntermediateRoot(false)
9393

9494
// Overwrite all the data with new values in the transient database.
9595
for i := byte(0); i < 255; i++ {
96-
modify(transState, common.Address{byte(i)}, i, 99)
97-
modify(finalState, common.Address{byte(i)}, i, 99)
96+
modify(transState, common.Address{i}, i, 99)
97+
modify(finalState, common.Address{i}, i, 99)
9898
}
9999

100100
// Commit and cross check the databases.

p2p/discover/v4_udp_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ func TestUDPv4_successfulPing(t *testing.T) {
454454
if !n.IP().Equal(test.remoteaddr.IP) {
455455
t.Errorf("node has wrong IP: got %v, want: %v", n.IP(), test.remoteaddr.IP)
456456
}
457-
if int(n.UDP()) != test.remoteaddr.Port {
457+
if n.UDP() != test.remoteaddr.Port {
458458
t.Errorf("node has wrong UDP port: got %v, want: %v", n.UDP(), test.remoteaddr.Port)
459459
}
460460
if n.TCP() != int(testRemote.TCP) {

trie/trie_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestEmptyTrie(t *testing.T) {
5252
var trie Trie
5353
res := trie.Hash()
5454
exp := emptyRoot
55-
if res != common.Hash(exp) {
55+
if res != exp {
5656
t.Errorf("expected %x got %x", exp, res)
5757
}
5858
}

whisper/whisperv6/whisper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func TestWhisperBasic(t *testing.T) {
7676
t.Fatalf("failed w.Envelopes().")
7777
}
7878

79-
derived := pbkdf2.Key([]byte(peerID), nil, 65356, aesKeyLength, sha256.New)
79+
derived := pbkdf2.Key(peerID, nil, 65356, aesKeyLength, sha256.New)
8080
if !validateDataIntegrity(derived, aesKeyLength) {
8181
t.Fatalf("failed validateSymmetricKey with param = %v.", derived)
8282
}

0 commit comments

Comments
 (0)