diff --git a/accounts/keystore/keystore_plain_test.go b/accounts/keystore/keystore_plain_test.go index 6c0aa82f75a1..b6b82e70afaf 100644 --- a/accounts/keystore/keystore_plain_test.go +++ b/accounts/keystore/keystore_plain_test.go @@ -253,6 +253,25 @@ func TestKeyForDirectICAP(t *testing.T) { } } +func TestNewKeyForDirectICAP(t *testing.T) { + addr0 := common.HexToAddress("0x00ffffffffffffffffffffffffffffffffffffff") + addr1 := common.HexToAddress("0xffffffffffffffffffffffffffffffffffffffff") + tests := []struct { + name string + result bool + }{ + {"addresses start with 0", addr0[0] == 0}, + {"addresses not start with 0", addr1[0] != 0}, + {"addr0 starts with 0x00 or xdc00", strings.HasPrefix(addr0.Hex(), "0x00") || strings.HasPrefix(addr0.Hex(), "xdc00")}, + {"addr1 not start with 0x00 or xdc00", !(strings.HasPrefix(addr1.Hex(), "0x00") && strings.HasPrefix(addr1.Hex(), "xdc00"))}, + } + for _, tt := range tests { + if !tt.result { + t.Errorf("test %q failed\n", tt.name) + } + } +} + func TestV3_31_Byte_Key(t *testing.T) { t.Skip("This test does not ") t.Parallel()