forked from forks/go-ethereum
core/types: delete unused test variable (#31776)
Delete the unused `Account.PrivateKey` variable.
This commit is contained in:
parent
181dd2e660
commit
6bc57579d1
2 changed files with 12 additions and 22 deletions
|
|
@ -38,17 +38,13 @@ type Account struct {
|
||||||
Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
|
Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
|
||||||
Balance *big.Int `json:"balance" gencodec:"required"`
|
Balance *big.Int `json:"balance" gencodec:"required"`
|
||||||
Nonce uint64 `json:"nonce,omitempty"`
|
Nonce uint64 `json:"nonce,omitempty"`
|
||||||
|
|
||||||
// used in tests
|
|
||||||
PrivateKey []byte `json:"secretKey,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type accountMarshaling struct {
|
type accountMarshaling struct {
|
||||||
Code hexutil.Bytes
|
Code hexutil.Bytes
|
||||||
Balance *math.HexOrDecimal256
|
Balance *math.HexOrDecimal256
|
||||||
Nonce math.HexOrDecimal64
|
Nonce math.HexOrDecimal64
|
||||||
Storage map[storageJSON]storageJSON
|
Storage map[storageJSON]storageJSON
|
||||||
PrivateKey hexutil.Bytes
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// storageJSON represents a 256 bit byte array, but allows less than 256 bits when
|
// storageJSON represents a 256 bit byte array, but allows less than 256 bits when
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,10 @@ var _ = (*accountMarshaling)(nil)
|
||||||
// MarshalJSON marshals as JSON.
|
// MarshalJSON marshals as JSON.
|
||||||
func (a Account) MarshalJSON() ([]byte, error) {
|
func (a Account) MarshalJSON() ([]byte, error) {
|
||||||
type Account struct {
|
type Account struct {
|
||||||
Code hexutil.Bytes `json:"code,omitempty"`
|
Code hexutil.Bytes `json:"code,omitempty"`
|
||||||
Storage map[storageJSON]storageJSON `json:"storage,omitempty"`
|
Storage map[storageJSON]storageJSON `json:"storage,omitempty"`
|
||||||
Balance *math.HexOrDecimal256 `json:"balance" gencodec:"required"`
|
Balance *math.HexOrDecimal256 `json:"balance" gencodec:"required"`
|
||||||
Nonce math.HexOrDecimal64 `json:"nonce,omitempty"`
|
Nonce math.HexOrDecimal64 `json:"nonce,omitempty"`
|
||||||
PrivateKey hexutil.Bytes `json:"secretKey,omitempty"`
|
|
||||||
}
|
}
|
||||||
var enc Account
|
var enc Account
|
||||||
enc.Code = a.Code
|
enc.Code = a.Code
|
||||||
|
|
@ -33,18 +32,16 @@ func (a Account) MarshalJSON() ([]byte, error) {
|
||||||
}
|
}
|
||||||
enc.Balance = (*math.HexOrDecimal256)(a.Balance)
|
enc.Balance = (*math.HexOrDecimal256)(a.Balance)
|
||||||
enc.Nonce = math.HexOrDecimal64(a.Nonce)
|
enc.Nonce = math.HexOrDecimal64(a.Nonce)
|
||||||
enc.PrivateKey = a.PrivateKey
|
|
||||||
return json.Marshal(&enc)
|
return json.Marshal(&enc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON unmarshals from JSON.
|
// UnmarshalJSON unmarshals from JSON.
|
||||||
func (a *Account) UnmarshalJSON(input []byte) error {
|
func (a *Account) UnmarshalJSON(input []byte) error {
|
||||||
type Account struct {
|
type Account struct {
|
||||||
Code *hexutil.Bytes `json:"code,omitempty"`
|
Code *hexutil.Bytes `json:"code,omitempty"`
|
||||||
Storage map[storageJSON]storageJSON `json:"storage,omitempty"`
|
Storage map[storageJSON]storageJSON `json:"storage,omitempty"`
|
||||||
Balance *math.HexOrDecimal256 `json:"balance" gencodec:"required"`
|
Balance *math.HexOrDecimal256 `json:"balance" gencodec:"required"`
|
||||||
Nonce *math.HexOrDecimal64 `json:"nonce,omitempty"`
|
Nonce *math.HexOrDecimal64 `json:"nonce,omitempty"`
|
||||||
PrivateKey *hexutil.Bytes `json:"secretKey,omitempty"`
|
|
||||||
}
|
}
|
||||||
var dec Account
|
var dec Account
|
||||||
if err := json.Unmarshal(input, &dec); err != nil {
|
if err := json.Unmarshal(input, &dec); err != nil {
|
||||||
|
|
@ -66,8 +63,5 @@ func (a *Account) UnmarshalJSON(input []byte) error {
|
||||||
if dec.Nonce != nil {
|
if dec.Nonce != nil {
|
||||||
a.Nonce = uint64(*dec.Nonce)
|
a.Nonce = uint64(*dec.Nonce)
|
||||||
}
|
}
|
||||||
if dec.PrivateKey != nil {
|
|
||||||
a.PrivateKey = *dec.PrivateKey
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue