Changes made to support unity across all plugeth projects with resepct to consensus engine.
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
gparams "github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
@@ -463,6 +464,28 @@ func (b *Backend) ChainConfig() *params.ChainConfig {
|
||||
return b.chainConfig
|
||||
}
|
||||
|
||||
func CloneChainConfig(cf *gparams.ChainConfig) *params.ChainConfig {
|
||||
result := ¶ms.ChainConfig{}
|
||||
nval := reflect.ValueOf(result)
|
||||
ntype := nval.Elem().Type()
|
||||
lval := reflect.ValueOf(cf)
|
||||
for i := 0; i < nval.Elem().NumField(); i++ {
|
||||
field := ntype.Field(i)
|
||||
v := nval.Elem().FieldByName(field.Name)
|
||||
lv := lval.Elem().FieldByName(field.Name)
|
||||
log.Info("Checking value for", "field", field.Name)
|
||||
if lv.Kind() != reflect.Invalid {
|
||||
// If core.ChainConfig doesn't have this field, skip it.
|
||||
if v.Type() == lv.Type() && lv.CanSet() {
|
||||
lv.Set(v)
|
||||
} else {
|
||||
convertAndSet(lv, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (b *Backend) GetTrie(h core.Hash) (core.Trie, error) {
|
||||
tr, err := trie.NewStateTrie(trie.TrieID(common.Hash(h)), trie.NewDatabase(b.b.ChainDb()))
|
||||
if err != nil {
|
||||
|
||||
@@ -11,7 +11,7 @@ type dbWrapper struct {
|
||||
db ethdb.Database
|
||||
}
|
||||
|
||||
func NewDB(d ethdb.Database) restricted.Database {
|
||||
func NewDb(d ethdb.Database) restricted.Database {
|
||||
return &dbWrapper{d}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user