accounts: remove redundant conversions and import names (#21903)

This commit is contained in:
Daniel Liu 2025-01-14 10:56:11 +08:00
parent 7f2ae32933
commit 25284155d8
3 changed files with 4 additions and 4 deletions

View file

@ -202,12 +202,12 @@ func TestConvertType(t *testing.T) {
fields = append(fields, reflect.StructField{ fields = append(fields, reflect.StructField{
Name: "X", Name: "X",
Type: reflect.TypeOf(new(big.Int)), Type: reflect.TypeOf(new(big.Int)),
Tag: reflect.StructTag("json:\"" + "x" + "\""), Tag: "json:\"" + "x" + "\"",
}) })
fields = append(fields, reflect.StructField{ fields = append(fields, reflect.StructField{
Name: "Y", Name: "Y",
Type: reflect.TypeOf(new(big.Int)), Type: reflect.TypeOf(new(big.Int)),
Tag: reflect.StructTag("json:\"" + "y" + "\""), Tag: "json:\"" + "y" + "\"",
}) })
val := reflect.New(reflect.StructOf(fields)) val := reflect.New(reflect.StructOf(fields))
val.Elem().Field(0).Set(reflect.ValueOf(big.NewInt(1))) val.Elem().Field(0).Set(reflect.ValueOf(big.NewInt(1)))

View file

@ -255,7 +255,7 @@ func TestTypeCheck(t *testing.T) {
{"bytes", nil, [2]byte{0, 1}, "abi: cannot use array as type slice as argument"}, {"bytes", nil, [2]byte{0, 1}, "abi: cannot use array as type slice as argument"},
{"bytes", nil, common.Hash{1}, "abi: cannot use array as type slice as argument"}, {"bytes", nil, common.Hash{1}, "abi: cannot use array as type slice as argument"},
{"string", nil, "hello world", ""}, {"string", nil, "hello world", ""},
{"string", nil, string(""), ""}, {"string", nil, "", ""},
{"string", nil, []byte{}, "abi: cannot use slice as type string as argument"}, {"string", nil, []byte{}, "abi: cannot use slice as type string as argument"},
{"bytes32[]", nil, [][32]byte{{}}, ""}, {"bytes32[]", nil, [][32]byte{{}}, ""},
{"function", nil, [24]byte{}, ""}, {"function", nil, [24]byte{}, ""},

View file

@ -228,7 +228,7 @@ func DecryptKey(keyjson []byte, auth string) (*Key, error) {
key := crypto.ToECDSAUnsafe(keyBytes) key := crypto.ToECDSAUnsafe(keyBytes)
return &Key{ return &Key{
Id: uuid.UUID(keyId), Id: keyId,
Address: crypto.PubkeyToAddress(key.PublicKey), Address: crypto.PubkeyToAddress(key.PublicKey),
PrivateKey: key, PrivateKey: key,
}, nil }, nil