mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
436493350e
1. changes sentinel to use an http-like interface 2. moves hexutil, crypto/blake2b, metrics packages to erigon-lib
58 lines
1.5 KiB
Go
58 lines
1.5 KiB
Go
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
package native
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/ledgerwatch/erigon-lib/common/hexutil"
|
|
"math/big"
|
|
|
|
libcommon "github.com/ledgerwatch/erigon-lib/common"
|
|
"github.com/ledgerwatch/erigon-lib/common/hexutility"
|
|
)
|
|
|
|
var _ = (*accountMarshaling)(nil)
|
|
|
|
// MarshalJSON marshals as JSON.
|
|
func (a account) MarshalJSON() ([]byte, error) {
|
|
type account struct {
|
|
Balance *hexutil.Big `json:"balance,omitempty"`
|
|
Code hexutility.Bytes `json:"code,omitempty"`
|
|
Nonce uint64 `json:"nonce,omitempty"`
|
|
Storage map[libcommon.Hash]libcommon.Hash `json:"storage,omitempty"`
|
|
}
|
|
var enc account
|
|
enc.Balance = (*hexutil.Big)(a.Balance)
|
|
enc.Code = a.Code
|
|
enc.Nonce = a.Nonce
|
|
enc.Storage = a.Storage
|
|
return json.Marshal(&enc)
|
|
}
|
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
|
func (a *account) UnmarshalJSON(input []byte) error {
|
|
type account struct {
|
|
Balance *hexutil.Big `json:"balance,omitempty"`
|
|
Code *hexutility.Bytes `json:"code,omitempty"`
|
|
Nonce *uint64 `json:"nonce,omitempty"`
|
|
Storage map[libcommon.Hash]libcommon.Hash `json:"storage,omitempty"`
|
|
}
|
|
var dec account
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
return err
|
|
}
|
|
if dec.Balance != nil {
|
|
a.Balance = (*big.Int)(dec.Balance)
|
|
}
|
|
if dec.Code != nil {
|
|
a.Code = *dec.Code
|
|
}
|
|
if dec.Nonce != nil {
|
|
a.Nonce = *dec.Nonce
|
|
}
|
|
if dec.Storage != nil {
|
|
a.Storage = dec.Storage
|
|
}
|
|
return nil
|
|
}
|