core/state, p2p/discover, trie, whisper: avoid unnecessary conversions (#19870)
No need to convert these types.
This commit is contained in:
parent
a1f8549262
commit
5183483c53
@ -86,15 +86,15 @@ func TestIntermediateLeaks(t *testing.T) {
|
|||||||
|
|
||||||
// Modify the transient state.
|
// Modify the transient state.
|
||||||
for i := byte(0); i < 255; i++ {
|
for i := byte(0); i < 255; i++ {
|
||||||
modify(transState, common.Address{byte(i)}, i, 0)
|
modify(transState, common.Address{i}, i, 0)
|
||||||
}
|
}
|
||||||
// Write modifications to trie.
|
// Write modifications to trie.
|
||||||
transState.IntermediateRoot(false)
|
transState.IntermediateRoot(false)
|
||||||
|
|
||||||
// Overwrite all the data with new values in the transient database.
|
// Overwrite all the data with new values in the transient database.
|
||||||
for i := byte(0); i < 255; i++ {
|
for i := byte(0); i < 255; i++ {
|
||||||
modify(transState, common.Address{byte(i)}, i, 99)
|
modify(transState, common.Address{i}, i, 99)
|
||||||
modify(finalState, common.Address{byte(i)}, i, 99)
|
modify(finalState, common.Address{i}, i, 99)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit and cross check the databases.
|
// Commit and cross check the databases.
|
||||||
|
@ -454,7 +454,7 @@ func TestUDPv4_successfulPing(t *testing.T) {
|
|||||||
if !n.IP().Equal(test.remoteaddr.IP) {
|
if !n.IP().Equal(test.remoteaddr.IP) {
|
||||||
t.Errorf("node has wrong IP: got %v, want: %v", n.IP(), test.remoteaddr.IP)
|
t.Errorf("node has wrong IP: got %v, want: %v", n.IP(), test.remoteaddr.IP)
|
||||||
}
|
}
|
||||||
if int(n.UDP()) != test.remoteaddr.Port {
|
if n.UDP() != test.remoteaddr.Port {
|
||||||
t.Errorf("node has wrong UDP port: got %v, want: %v", n.UDP(), test.remoteaddr.Port)
|
t.Errorf("node has wrong UDP port: got %v, want: %v", n.UDP(), test.remoteaddr.Port)
|
||||||
}
|
}
|
||||||
if n.TCP() != int(testRemote.TCP) {
|
if n.TCP() != int(testRemote.TCP) {
|
||||||
|
@ -52,7 +52,7 @@ func TestEmptyTrie(t *testing.T) {
|
|||||||
var trie Trie
|
var trie Trie
|
||||||
res := trie.Hash()
|
res := trie.Hash()
|
||||||
exp := emptyRoot
|
exp := emptyRoot
|
||||||
if res != common.Hash(exp) {
|
if res != exp {
|
||||||
t.Errorf("expected %x got %x", exp, res)
|
t.Errorf("expected %x got %x", exp, res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ func TestWhisperBasic(t *testing.T) {
|
|||||||
t.Fatalf("failed w.Envelopes().")
|
t.Fatalf("failed w.Envelopes().")
|
||||||
}
|
}
|
||||||
|
|
||||||
derived := pbkdf2.Key([]byte(peerID), nil, 65356, aesKeyLength, sha256.New)
|
derived := pbkdf2.Key(peerID, nil, 65356, aesKeyLength, sha256.New)
|
||||||
if !validateDataIntegrity(derived, aesKeyLength) {
|
if !validateDataIntegrity(derived, aesKeyLength) {
|
||||||
t.Fatalf("failed validateSymmetricKey with param = %v.", derived)
|
t.Fatalf("failed validateSymmetricKey with param = %v.", derived)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user