1
0
Fork 0
forked from forks/go-ethereum

core/types: delete unused test variable (#31776)

Delete the unused `Account.PrivateKey` variable.
This commit is contained in:
maskpp 2025-05-08 21:21:48 +08:00 committed by GitHub
parent 181dd2e660
commit 6bc57579d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 22 deletions

View file

@ -38,9 +38,6 @@ type Account struct {
Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
Balance *big.Int `json:"balance" gencodec:"required"`
Nonce uint64 `json:"nonce,omitempty"`
// used in tests
PrivateKey []byte `json:"secretKey,omitempty"`
}
type accountMarshaling struct {
@ -48,7 +45,6 @@ type accountMarshaling struct {
Balance *math.HexOrDecimal256
Nonce math.HexOrDecimal64
Storage map[storageJSON]storageJSON
PrivateKey hexutil.Bytes
}
// storageJSON represents a 256 bit byte array, but allows less than 256 bits when

View file

@ -21,7 +21,6 @@ func (a Account) MarshalJSON() ([]byte, error) {
Storage map[storageJSON]storageJSON `json:"storage,omitempty"`
Balance *math.HexOrDecimal256 `json:"balance" gencodec:"required"`
Nonce math.HexOrDecimal64 `json:"nonce,omitempty"`
PrivateKey hexutil.Bytes `json:"secretKey,omitempty"`
}
var enc Account
enc.Code = a.Code
@ -33,7 +32,6 @@ func (a Account) MarshalJSON() ([]byte, error) {
}
enc.Balance = (*math.HexOrDecimal256)(a.Balance)
enc.Nonce = math.HexOrDecimal64(a.Nonce)
enc.PrivateKey = a.PrivateKey
return json.Marshal(&enc)
}
@ -44,7 +42,6 @@ func (a *Account) UnmarshalJSON(input []byte) error {
Storage map[storageJSON]storageJSON `json:"storage,omitempty"`
Balance *math.HexOrDecimal256 `json:"balance" gencodec:"required"`
Nonce *math.HexOrDecimal64 `json:"nonce,omitempty"`
PrivateKey *hexutil.Bytes `json:"secretKey,omitempty"`
}
var dec Account
if err := json.Unmarshal(input, &dec); err != nil {
@ -66,8 +63,5 @@ func (a *Account) UnmarshalJSON(input []byte) error {
if dec.Nonce != nil {
a.Nonce = uint64(*dec.Nonce)
}
if dec.PrivateKey != nil {
a.PrivateKey = *dec.PrivateKey
}
return nil
}