mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 02:10:46 +00:00
Merge pull request #803 from gzliudan/go_generate
all: update files by 'go generate ./...'
This commit is contained in:
commit
d1d95e2e64
7 changed files with 143 additions and 66 deletions
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -92,15 +93,15 @@ func faucetHtml() (*asset, error) {
|
||||||
// It returns an error if the asset could not be found or
|
// It returns an error if the asset could not be found or
|
||||||
// could not be loaded.
|
// could not be loaded.
|
||||||
func Asset(name string) ([]byte, error) {
|
func Asset(name string) ([]byte, error) {
|
||||||
canonicalName := strings.ReplaceAll(name, "\\", "/")
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
if f, ok := _bindata[canonicalName]; ok {
|
if f, ok := _bindata[canonicalName]; ok {
|
||||||
a, err := f()
|
a, err := f()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't read Asset %s by error: %v", name, err)
|
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||||||
}
|
}
|
||||||
return a.bytes, nil
|
return a.bytes, nil
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("not found Asset %s", name)
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssetString returns the asset contents as a string (instead of a []byte).
|
// AssetString returns the asset contents as a string (instead of a []byte).
|
||||||
|
|
@ -130,29 +131,29 @@ func MustAssetString(name string) string {
|
||||||
// It returns an error if the asset could not be found or
|
// It returns an error if the asset could not be found or
|
||||||
// could not be loaded.
|
// could not be loaded.
|
||||||
func AssetInfo(name string) (os.FileInfo, error) {
|
func AssetInfo(name string) (os.FileInfo, error) {
|
||||||
canonicalName := strings.ReplaceAll(name, "\\", "/")
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
if f, ok := _bindata[canonicalName]; ok {
|
if f, ok := _bindata[canonicalName]; ok {
|
||||||
a, err := f()
|
a, err := f()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't read AssetInfo %s by error: %v", name, err)
|
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||||||
}
|
}
|
||||||
return a.info, nil
|
return a.info, nil
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("not found AssetInfo %s", name)
|
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssetDigest returns the digest of the file with the given name. It returns an
|
// AssetDigest returns the digest of the file with the given name. It returns an
|
||||||
// error if the asset could not be found or the digest could not be loaded.
|
// error if the asset could not be found or the digest could not be loaded.
|
||||||
func AssetDigest(name string) ([sha256.Size]byte, error) {
|
func AssetDigest(name string) ([sha256.Size]byte, error) {
|
||||||
canonicalName := strings.ReplaceAll(name, "\\", "/")
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
if f, ok := _bindata[canonicalName]; ok {
|
if f, ok := _bindata[canonicalName]; ok {
|
||||||
a, err := f()
|
a, err := f()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return [sha256.Size]byte{}, fmt.Errorf("can't read AssetDigest %s by error: %v", name, err)
|
return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err)
|
||||||
}
|
}
|
||||||
return a.digest, nil
|
return a.digest, nil
|
||||||
}
|
}
|
||||||
return [sha256.Size]byte{}, fmt.Errorf("not found AssetDigest %s", name)
|
return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Digests returns a map of all known files and their checksums.
|
// Digests returns a map of all known files and their checksums.
|
||||||
|
|
@ -203,17 +204,17 @@ const AssetDebug = false
|
||||||
func AssetDir(name string) ([]string, error) {
|
func AssetDir(name string) ([]string, error) {
|
||||||
node := _bintree
|
node := _bintree
|
||||||
if len(name) != 0 {
|
if len(name) != 0 {
|
||||||
canonicalName := strings.ReplaceAll(name, "\\", "/")
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
pathList := strings.Split(canonicalName, "/")
|
pathList := strings.Split(canonicalName, "/")
|
||||||
for _, p := range pathList {
|
for _, p := range pathList {
|
||||||
node = node.Children[p]
|
node = node.Children[p]
|
||||||
if node == nil {
|
if node == nil {
|
||||||
return nil, fmt.Errorf("not found Asset %s", name)
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if node.Func != nil {
|
if node.Func != nil {
|
||||||
return nil, fmt.Errorf("not found Asset %s", name)
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||||||
}
|
}
|
||||||
rv := make([]string, 0, len(node.Children))
|
rv := make([]string, 0, len(node.Children))
|
||||||
for childName := range node.Children {
|
for childName := range node.Children {
|
||||||
|
|
@ -245,7 +246,7 @@ func RestoreAsset(dir, name string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = os.WriteFile(_filePath(dir, name), data, info.Mode())
|
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -270,6 +271,6 @@ func RestoreAssets(dir, name string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func _filePath(dir, name string) string {
|
func _filePath(dir, name string) string {
|
||||||
canonicalName := strings.ReplaceAll(name, "\\", "/")
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...)
|
return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ func (h Header) MarshalJSON() ([]byte, error) {
|
||||||
Extra hexutil.Bytes `json:"extraData" gencodec:"required"`
|
Extra hexutil.Bytes `json:"extraData" gencodec:"required"`
|
||||||
MixDigest common.Hash `json:"mixHash" gencodec:"required"`
|
MixDigest common.Hash `json:"mixHash" gencodec:"required"`
|
||||||
Nonce BlockNonce `json:"nonce" gencodec:"required"`
|
Nonce BlockNonce `json:"nonce" gencodec:"required"`
|
||||||
|
Validators []byte `json:"validators" gencodec:"required"`
|
||||||
|
Validator []byte `json:"validator" gencodec:"required"`
|
||||||
|
Penalties []byte `json:"penalties" gencodec:"required"`
|
||||||
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"`
|
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"`
|
||||||
Hash common.Hash `json:"hash"`
|
Hash common.Hash `json:"hash"`
|
||||||
}
|
}
|
||||||
|
|
@ -50,6 +53,9 @@ func (h Header) MarshalJSON() ([]byte, error) {
|
||||||
enc.Extra = h.Extra
|
enc.Extra = h.Extra
|
||||||
enc.MixDigest = h.MixDigest
|
enc.MixDigest = h.MixDigest
|
||||||
enc.Nonce = h.Nonce
|
enc.Nonce = h.Nonce
|
||||||
|
enc.Validators = h.Validators
|
||||||
|
enc.Validator = h.Validator
|
||||||
|
enc.Penalties = h.Penalties
|
||||||
enc.BaseFee = (*hexutil.Big)(h.BaseFee)
|
enc.BaseFee = (*hexutil.Big)(h.BaseFee)
|
||||||
enc.Hash = h.Hash()
|
enc.Hash = h.Hash()
|
||||||
return json.Marshal(&enc)
|
return json.Marshal(&enc)
|
||||||
|
|
@ -73,6 +79,9 @@ func (h *Header) UnmarshalJSON(input []byte) error {
|
||||||
Extra *hexutil.Bytes `json:"extraData" gencodec:"required"`
|
Extra *hexutil.Bytes `json:"extraData" gencodec:"required"`
|
||||||
MixDigest *common.Hash `json:"mixHash" gencodec:"required"`
|
MixDigest *common.Hash `json:"mixHash" gencodec:"required"`
|
||||||
Nonce *BlockNonce `json:"nonce" gencodec:"required"`
|
Nonce *BlockNonce `json:"nonce" gencodec:"required"`
|
||||||
|
Validators []byte `json:"validators" gencodec:"required"`
|
||||||
|
Validator []byte `json:"validator" gencodec:"required"`
|
||||||
|
Penalties []byte `json:"penalties" gencodec:"required"`
|
||||||
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"`
|
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"`
|
||||||
}
|
}
|
||||||
var dec Header
|
var dec Header
|
||||||
|
|
@ -139,6 +148,18 @@ func (h *Header) UnmarshalJSON(input []byte) error {
|
||||||
return errors.New("missing required field 'nonce' for Header")
|
return errors.New("missing required field 'nonce' for Header")
|
||||||
}
|
}
|
||||||
h.Nonce = *dec.Nonce
|
h.Nonce = *dec.Nonce
|
||||||
|
if dec.Validators == nil {
|
||||||
|
return errors.New("missing required field 'validators' for Header")
|
||||||
|
}
|
||||||
|
h.Validators = dec.Validators
|
||||||
|
if dec.Validator == nil {
|
||||||
|
return errors.New("missing required field 'validator' for Header")
|
||||||
|
}
|
||||||
|
h.Validator = dec.Validator
|
||||||
|
if dec.Penalties == nil {
|
||||||
|
return errors.New("missing required field 'penalties' for Header")
|
||||||
|
}
|
||||||
|
h.Penalties = dec.Penalties
|
||||||
if dec.BaseFee != nil {
|
if dec.BaseFee != nil {
|
||||||
h.BaseFee = (*big.Int)(dec.BaseFee)
|
h.BaseFee = (*big.Int)(dec.BaseFee)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/XinFinOrg/XDPoSChain/common"
|
"github.com/XinFinOrg/XDPoSChain/common"
|
||||||
|
"github.com/XinFinOrg/XDPoSChain/common/hexutil"
|
||||||
"github.com/XinFinOrg/XDPoSChain/consensus/ethash"
|
"github.com/XinFinOrg/XDPoSChain/consensus/ethash"
|
||||||
"github.com/XinFinOrg/XDPoSChain/core"
|
"github.com/XinFinOrg/XDPoSChain/core"
|
||||||
"github.com/XinFinOrg/XDPoSChain/core/txpool"
|
"github.com/XinFinOrg/XDPoSChain/core/txpool"
|
||||||
|
|
@ -14,6 +15,8 @@ import (
|
||||||
"github.com/XinFinOrg/XDPoSChain/eth/gasprice"
|
"github.com/XinFinOrg/XDPoSChain/eth/gasprice"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ = (*configMarshaling)(nil)
|
||||||
|
|
||||||
// MarshalTOML marshals as TOML.
|
// MarshalTOML marshals as TOML.
|
||||||
func (c Config) MarshalTOML() (interface{}, error) {
|
func (c Config) MarshalTOML() (interface{}, error) {
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|
@ -28,11 +31,11 @@ func (c Config) MarshalTOML() (interface{}, error) {
|
||||||
DatabaseCache int
|
DatabaseCache int
|
||||||
TrieCache int
|
TrieCache int
|
||||||
TrieTimeout time.Duration
|
TrieTimeout time.Duration
|
||||||
|
FilterLogCacheSize int
|
||||||
Etherbase common.Address `toml:",omitempty"`
|
Etherbase common.Address `toml:",omitempty"`
|
||||||
MinerThreads int `toml:",omitempty"`
|
MinerThreads int `toml:",omitempty"`
|
||||||
ExtraData []byte `toml:",omitempty"`
|
ExtraData hexutil.Bytes `toml:",omitempty"`
|
||||||
GasPrice *big.Int
|
GasPrice *big.Int
|
||||||
FilterLogCacheSize int
|
|
||||||
Ethash ethash.Config
|
Ethash ethash.Config
|
||||||
TxPool txpool.Config
|
TxPool txpool.Config
|
||||||
GPO gasprice.Config
|
GPO gasprice.Config
|
||||||
|
|
@ -53,11 +56,11 @@ func (c Config) MarshalTOML() (interface{}, error) {
|
||||||
enc.DatabaseCache = c.DatabaseCache
|
enc.DatabaseCache = c.DatabaseCache
|
||||||
enc.TrieCache = c.TrieCache
|
enc.TrieCache = c.TrieCache
|
||||||
enc.TrieTimeout = c.TrieTimeout
|
enc.TrieTimeout = c.TrieTimeout
|
||||||
|
enc.FilterLogCacheSize = c.FilterLogCacheSize
|
||||||
enc.Etherbase = c.Etherbase
|
enc.Etherbase = c.Etherbase
|
||||||
enc.MinerThreads = c.MinerThreads
|
enc.MinerThreads = c.MinerThreads
|
||||||
enc.ExtraData = c.ExtraData
|
enc.ExtraData = c.ExtraData
|
||||||
enc.GasPrice = c.GasPrice
|
enc.GasPrice = c.GasPrice
|
||||||
enc.FilterLogCacheSize = c.FilterLogCacheSize
|
|
||||||
enc.Ethash = c.Ethash
|
enc.Ethash = c.Ethash
|
||||||
enc.TxPool = c.TxPool
|
enc.TxPool = c.TxPool
|
||||||
enc.GPO = c.GPO
|
enc.GPO = c.GPO
|
||||||
|
|
@ -82,11 +85,11 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
|
||||||
DatabaseCache *int
|
DatabaseCache *int
|
||||||
TrieCache *int
|
TrieCache *int
|
||||||
TrieTimeout *time.Duration
|
TrieTimeout *time.Duration
|
||||||
|
FilterLogCacheSize *int
|
||||||
Etherbase *common.Address `toml:",omitempty"`
|
Etherbase *common.Address `toml:",omitempty"`
|
||||||
MinerThreads *int `toml:",omitempty"`
|
MinerThreads *int `toml:",omitempty"`
|
||||||
ExtraData []byte `toml:",omitempty"`
|
ExtraData *hexutil.Bytes `toml:",omitempty"`
|
||||||
GasPrice *big.Int
|
GasPrice *big.Int
|
||||||
FilterLogCacheSize *int
|
|
||||||
Ethash *ethash.Config
|
Ethash *ethash.Config
|
||||||
TxPool *txpool.Config
|
TxPool *txpool.Config
|
||||||
GPO *gasprice.Config
|
GPO *gasprice.Config
|
||||||
|
|
@ -132,6 +135,9 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
|
||||||
if dec.TrieTimeout != nil {
|
if dec.TrieTimeout != nil {
|
||||||
c.TrieTimeout = *dec.TrieTimeout
|
c.TrieTimeout = *dec.TrieTimeout
|
||||||
}
|
}
|
||||||
|
if dec.FilterLogCacheSize != nil {
|
||||||
|
c.FilterLogCacheSize = *dec.FilterLogCacheSize
|
||||||
|
}
|
||||||
if dec.Etherbase != nil {
|
if dec.Etherbase != nil {
|
||||||
c.Etherbase = *dec.Etherbase
|
c.Etherbase = *dec.Etherbase
|
||||||
}
|
}
|
||||||
|
|
@ -139,14 +145,11 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
|
||||||
c.MinerThreads = *dec.MinerThreads
|
c.MinerThreads = *dec.MinerThreads
|
||||||
}
|
}
|
||||||
if dec.ExtraData != nil {
|
if dec.ExtraData != nil {
|
||||||
c.ExtraData = dec.ExtraData
|
c.ExtraData = *dec.ExtraData
|
||||||
}
|
}
|
||||||
if dec.GasPrice != nil {
|
if dec.GasPrice != nil {
|
||||||
c.GasPrice = dec.GasPrice
|
c.GasPrice = dec.GasPrice
|
||||||
}
|
}
|
||||||
if dec.FilterLogCacheSize != nil {
|
|
||||||
c.FilterLogCacheSize = *dec.FilterLogCacheSize
|
|
||||||
}
|
|
||||||
if dec.Ethash != nil {
|
if dec.Ethash != nil {
|
||||||
c.Ethash = *dec.Ethash
|
c.Ethash = *dec.Ethash
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
// Code generated for package deps by go-bindata DO NOT EDIT. (@generated)
|
// Code generated by go-bindata. DO NOT EDIT.
|
||||||
// sources:
|
// sources:
|
||||||
// bignumber.js
|
// bignumber.js (17.314kB)
|
||||||
// web3.js
|
// web3.js (404.708kB)
|
||||||
|
|
||||||
package deps
|
package deps
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
|
"crypto/sha256"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
@ -19,7 +21,7 @@ import (
|
||||||
func bindataRead(data []byte, name string) ([]byte, error) {
|
func bindataRead(data []byte, name string) ([]byte, error) {
|
||||||
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("read %q: %v", name, err)
|
return nil, fmt.Errorf("read %q: %w", name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
|
@ -27,7 +29,7 @@ func bindataRead(data []byte, name string) ([]byte, error) {
|
||||||
clErr := gz.Close()
|
clErr := gz.Close()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("read %q: %v", name, err)
|
return nil, fmt.Errorf("read %q: %w", name, err)
|
||||||
}
|
}
|
||||||
if clErr != nil {
|
if clErr != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -37,8 +39,9 @@ func bindataRead(data []byte, name string) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type asset struct {
|
type asset struct {
|
||||||
bytes []byte
|
bytes []byte
|
||||||
info os.FileInfo
|
info os.FileInfo
|
||||||
|
digest [sha256.Size]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type bindataFileInfo struct {
|
type bindataFileInfo struct {
|
||||||
|
|
@ -48,32 +51,21 @@ type bindataFileInfo struct {
|
||||||
modTime time.Time
|
modTime time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name return file name
|
|
||||||
func (fi bindataFileInfo) Name() string {
|
func (fi bindataFileInfo) Name() string {
|
||||||
return fi.name
|
return fi.name
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size return file size
|
|
||||||
func (fi bindataFileInfo) Size() int64 {
|
func (fi bindataFileInfo) Size() int64 {
|
||||||
return fi.size
|
return fi.size
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mode return file mode
|
|
||||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||||
return fi.mode
|
return fi.mode
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mode return file modify time
|
|
||||||
func (fi bindataFileInfo) ModTime() time.Time {
|
func (fi bindataFileInfo) ModTime() time.Time {
|
||||||
return fi.modTime
|
return fi.modTime
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsDir return file whether a directory
|
|
||||||
func (fi bindataFileInfo) IsDir() bool {
|
func (fi bindataFileInfo) IsDir() bool {
|
||||||
return fi.mode&os.ModeDir != 0
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sys return file is sys mode
|
|
||||||
func (fi bindataFileInfo) Sys() interface{} {
|
func (fi bindataFileInfo) Sys() interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +86,7 @@ func bignumberJs() (*asset, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "bignumber.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
|
info := bindataFileInfo{name: "bignumber.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5b, 0x75, 0xfc, 0x15, 0x5e, 0x7d, 0x27, 0x1a, 0x9a, 0xb5, 0xfb, 0x16, 0x90, 0xf4, 0x93, 0xac, 0xcb, 0x6c, 0x9c, 0xcd, 0x68, 0xe6, 0xd0, 0x3a, 0xcf, 0xa3, 0x83, 0x5c, 0x20, 0x34, 0x66, 0x45}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,7 +106,7 @@ func web3Js() (*asset, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "web3.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
|
info := bindataFileInfo{name: "web3.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x45, 0x22, 0xe4, 0x7f, 0xec, 0xaa, 0x22, 0xce, 0x38, 0x35, 0x77, 0xff, 0xa2, 0xd3, 0xf2, 0x95, 0xd4, 0x59, 0xb7, 0xb, 0xff, 0x46, 0xff, 0x8b, 0x73, 0xb2, 0xb4, 0xf0, 0x8c, 0x21, 0x79, 0xd0}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,15 +114,21 @@ func web3Js() (*asset, error) {
|
||||||
// It returns an error if the asset could not be found or
|
// It returns an error if the asset could not be found or
|
||||||
// could not be loaded.
|
// could not be loaded.
|
||||||
func Asset(name string) ([]byte, error) {
|
func Asset(name string) ([]byte, error) {
|
||||||
cannonicalName := strings.ReplaceAll(name, "\\", "/")
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
if f, ok := _bindata[cannonicalName]; ok {
|
if f, ok := _bindata[canonicalName]; ok {
|
||||||
a, err := f()
|
a, err := f()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't read Asset %s by error: %v", name, err)
|
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||||||
}
|
}
|
||||||
return a.bytes, nil
|
return a.bytes, nil
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("not found Asset %s", name)
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AssetString returns the asset contents as a string (instead of a []byte).
|
||||||
|
func AssetString(name string) (string, error) {
|
||||||
|
data, err := Asset(name)
|
||||||
|
return string(data), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// MustAsset is like Asset but panics when Asset would return an error.
|
// MustAsset is like Asset but panics when Asset would return an error.
|
||||||
|
|
@ -144,19 +142,52 @@ func MustAsset(name string) []byte {
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MustAssetString is like AssetString but panics when Asset would return an
|
||||||
|
// error. It simplifies safe initialization of global variables.
|
||||||
|
func MustAssetString(name string) string {
|
||||||
|
return string(MustAsset(name))
|
||||||
|
}
|
||||||
|
|
||||||
// AssetInfo loads and returns the asset info for the given name.
|
// AssetInfo loads and returns the asset info for the given name.
|
||||||
// It returns an error if the asset could not be found or
|
// It returns an error if the asset could not be found or
|
||||||
// could not be loaded.
|
// could not be loaded.
|
||||||
func AssetInfo(name string) (os.FileInfo, error) {
|
func AssetInfo(name string) (os.FileInfo, error) {
|
||||||
cannonicalName := strings.ReplaceAll(name, "\\", "/")
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
if f, ok := _bindata[cannonicalName]; ok {
|
if f, ok := _bindata[canonicalName]; ok {
|
||||||
a, err := f()
|
a, err := f()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't read AssetInfo %s by error: %v", name, err)
|
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||||||
}
|
}
|
||||||
return a.info, nil
|
return a.info, nil
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("not found AssetInfo %s", name)
|
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AssetDigest returns the digest of the file with the given name. It returns an
|
||||||
|
// error if the asset could not be found or the digest could not be loaded.
|
||||||
|
func AssetDigest(name string) ([sha256.Size]byte, error) {
|
||||||
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
|
if f, ok := _bindata[canonicalName]; ok {
|
||||||
|
a, err := f()
|
||||||
|
if err != nil {
|
||||||
|
return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err)
|
||||||
|
}
|
||||||
|
return a.digest, nil
|
||||||
|
}
|
||||||
|
return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Digests returns a map of all known files and their checksums.
|
||||||
|
func Digests() (map[string][sha256.Size]byte, error) {
|
||||||
|
mp := make(map[string][sha256.Size]byte, len(_bindata))
|
||||||
|
for name := range _bindata {
|
||||||
|
a, err := _bindata[name]()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
mp[name] = a.digest
|
||||||
|
}
|
||||||
|
return mp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssetNames returns the names of the assets.
|
// AssetNames returns the names of the assets.
|
||||||
|
|
@ -174,6 +205,9 @@ var _bindata = map[string]func() (*asset, error){
|
||||||
"web3.js": web3Js,
|
"web3.js": web3Js,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AssetDebug is true if the assets were built with the debug flag enabled.
|
||||||
|
const AssetDebug = false
|
||||||
|
|
||||||
// AssetDir returns the file names below a certain
|
// AssetDir returns the file names below a certain
|
||||||
// directory embedded in the file by go-bindata.
|
// directory embedded in the file by go-bindata.
|
||||||
// For example if you run go-bindata on data/... and data contains the
|
// For example if you run go-bindata on data/... and data contains the
|
||||||
|
|
@ -185,15 +219,15 @@ var _bindata = map[string]func() (*asset, error){
|
||||||
// a.png
|
// a.png
|
||||||
// b.png
|
// b.png
|
||||||
//
|
//
|
||||||
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
// then AssetDir("data") would return []string{"foo.txt", "img"},
|
||||||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
// AssetDir("data/img") would return []string{"a.png", "b.png"},
|
||||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and
|
||||||
// AssetDir("") will return []string{"data"}.
|
// AssetDir("") will return []string{"data"}.
|
||||||
func AssetDir(name string) ([]string, error) {
|
func AssetDir(name string) ([]string, error) {
|
||||||
node := _bintree
|
node := _bintree
|
||||||
if len(name) != 0 {
|
if len(name) != 0 {
|
||||||
cannonicalName := strings.ReplaceAll(name, "\\", "/")
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
pathList := strings.Split(cannonicalName, "/")
|
pathList := strings.Split(canonicalName, "/")
|
||||||
for _, p := range pathList {
|
for _, p := range pathList {
|
||||||
node = node.Children[p]
|
node = node.Children[p]
|
||||||
if node == nil {
|
if node == nil {
|
||||||
|
|
@ -221,7 +255,7 @@ var _bintree = &bintree{nil, map[string]*bintree{
|
||||||
"web3.js": {web3Js, map[string]*bintree{}},
|
"web3.js": {web3Js, map[string]*bintree{}},
|
||||||
}}
|
}}
|
||||||
|
|
||||||
// RestoreAsset restores an asset under the given directory
|
// RestoreAsset restores an asset under the given directory.
|
||||||
func RestoreAsset(dir, name string) error {
|
func RestoreAsset(dir, name string) error {
|
||||||
data, err := Asset(name)
|
data, err := Asset(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -239,14 +273,10 @@ func RestoreAsset(dir, name string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RestoreAssets restores an asset under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively.
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
// File
|
// File
|
||||||
|
|
@ -264,6 +294,6 @@ func RestoreAssets(dir, name string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func _filePath(dir, name string) string {
|
func _filePath(dir, name string) string {
|
||||||
cannonicalName := strings.ReplaceAll(name, "\\", "/")
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,24 @@ package discv5
|
||||||
|
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
|
||||||
|
func _() {
|
||||||
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||||
|
// Re-run the stringer command to generate them again.
|
||||||
|
var x [1]struct{}
|
||||||
|
_ = x[invalidEvent-0]
|
||||||
|
_ = x[pingPacket-1]
|
||||||
|
_ = x[pongPacket-2]
|
||||||
|
_ = x[findnodePacket-3]
|
||||||
|
_ = x[neighborsPacket-4]
|
||||||
|
_ = x[findnodeHashPacket-5]
|
||||||
|
_ = x[topicRegisterPacket-6]
|
||||||
|
_ = x[topicQueryPacket-7]
|
||||||
|
_ = x[topicNodesPacket-8]
|
||||||
|
_ = x[pongTimeout-265]
|
||||||
|
_ = x[pingTimeout-266]
|
||||||
|
_ = x[neighboursTimeout-267]
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_nodeEvent_name_0 = "invalidEventpingPacketpongPacketfindnodePacketneighborsPacketfindnodeHashPackettopicRegisterPackettopicQueryPackettopicNodesPacket"
|
_nodeEvent_name_0 = "invalidEventpingPacketpongPacketfindnodePacketneighborsPacketfindnodeHashPackettopicRegisterPackettopicQueryPackettopicNodesPacket"
|
||||||
_nodeEvent_name_1 = "pongTimeoutpingTimeoutneighboursTimeout"
|
_nodeEvent_name_1 = "pongTimeoutpingTimeoutneighboursTimeout"
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import (
|
||||||
|
|
||||||
var _ = (*difficultyTestMarshaling)(nil)
|
var _ = (*difficultyTestMarshaling)(nil)
|
||||||
|
|
||||||
|
// MarshalJSON marshals as JSON.
|
||||||
func (d DifficultyTest) MarshalJSON() ([]byte, error) {
|
func (d DifficultyTest) MarshalJSON() ([]byte, error) {
|
||||||
type DifficultyTest struct {
|
type DifficultyTest struct {
|
||||||
ParentTimestamp *math.HexOrDecimal256 `json:"parentTimestamp"`
|
ParentTimestamp *math.HexOrDecimal256 `json:"parentTimestamp"`
|
||||||
|
|
@ -31,6 +32,7 @@ func (d DifficultyTest) MarshalJSON() ([]byte, error) {
|
||||||
return json.Marshal(&enc)
|
return json.Marshal(&enc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON unmarshals from JSON.
|
||||||
func (d *DifficultyTest) UnmarshalJSON(input []byte) error {
|
func (d *DifficultyTest) UnmarshalJSON(input []byte) error {
|
||||||
type DifficultyTest struct {
|
type DifficultyTest struct {
|
||||||
ParentTimestamp *math.HexOrDecimal256 `json:"parentTimestamp"`
|
ParentTimestamp *math.HexOrDecimal256 `json:"parentTimestamp"`
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import (
|
||||||
|
|
||||||
var _ = (*ttTransactionMarshaling)(nil)
|
var _ = (*ttTransactionMarshaling)(nil)
|
||||||
|
|
||||||
|
// MarshalJSON marshals as JSON.
|
||||||
func (t ttTransaction) MarshalJSON() ([]byte, error) {
|
func (t ttTransaction) MarshalJSON() ([]byte, error) {
|
||||||
type ttTransaction struct {
|
type ttTransaction struct {
|
||||||
Data hexutil.Bytes `gencodec:"required"`
|
Data hexutil.Bytes `gencodec:"required"`
|
||||||
|
|
@ -39,6 +40,7 @@ func (t ttTransaction) MarshalJSON() ([]byte, error) {
|
||||||
return json.Marshal(&enc)
|
return json.Marshal(&enc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON unmarshals from JSON.
|
||||||
func (t *ttTransaction) UnmarshalJSON(input []byte) error {
|
func (t *ttTransaction) UnmarshalJSON(input []byte) error {
|
||||||
type ttTransaction struct {
|
type ttTransaction struct {
|
||||||
Data *hexutil.Bytes `gencodec:"required"`
|
Data *hexutil.Bytes `gencodec:"required"`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue