mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
Merge branch 'develop' of https://github.com/ethereum/go-ethereum into develop
This commit is contained in:
commit
3d543fb9da
8 changed files with 11 additions and 26 deletions
|
|
@ -133,7 +133,6 @@ participating.
|
|||
utils.BootnodesFlag,
|
||||
utils.DataDirFlag,
|
||||
utils.KeyStoreDirFlag,
|
||||
utils.BlockchainVersionFlag,
|
||||
utils.OlympicFlag,
|
||||
utils.FastSyncFlag,
|
||||
utils.CacheFlag,
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ var AppHelpFlagGroups = []flagGroup{
|
|||
utils.FastSyncFlag,
|
||||
utils.LightKDFFlag,
|
||||
utils.CacheFlag,
|
||||
utils.BlockchainVersionFlag,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,11 +146,6 @@ var (
|
|||
Usage: "Megabytes of memory allocated to internal caching (min 16MB / database forced)",
|
||||
Value: 128,
|
||||
}
|
||||
BlockchainVersionFlag = cli.IntFlag{
|
||||
Name: "blockchainversion",
|
||||
Usage: "Blockchain version (integer)",
|
||||
Value: core.BlockChainVersion,
|
||||
}
|
||||
FastSyncFlag = cli.BoolFlag{
|
||||
Name: "fast",
|
||||
Usage: "Enable fast syncing through state downloads",
|
||||
|
|
@ -681,7 +676,6 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
|
|||
Etherbase: MakeEtherbase(stack.AccountManager(), ctx),
|
||||
ChainConfig: MustMakeChainConfig(ctx),
|
||||
FastSync: ctx.GlobalBool(FastSyncFlag.Name),
|
||||
BlockChainVersion: ctx.GlobalInt(BlockchainVersionFlag.Name),
|
||||
DatabaseCache: ctx.GlobalInt(CacheFlag.Name),
|
||||
DatabaseHandles: MakeDatabaseHandles(),
|
||||
NetworkId: ctx.GlobalInt(NetworkIdFlag.Name),
|
||||
|
|
|
|||
|
|
@ -71,8 +71,6 @@ type StateObject struct {
|
|||
codeHash []byte
|
||||
// The code for this account
|
||||
code Code
|
||||
// Temporarily initialisation code
|
||||
initCode Code
|
||||
// Cached storage (flushed when updated)
|
||||
storage Storage
|
||||
|
||||
|
|
@ -187,8 +185,7 @@ func (self *StateObject) Copy() *StateObject {
|
|||
stateObject.codeHash = common.CopyBytes(self.codeHash)
|
||||
stateObject.nonce = self.nonce
|
||||
stateObject.trie = self.trie
|
||||
stateObject.code = common.CopyBytes(self.code)
|
||||
stateObject.initCode = common.CopyBytes(self.initCode)
|
||||
stateObject.code = self.code
|
||||
stateObject.storage = self.storage.Copy()
|
||||
stateObject.remove = self.remove
|
||||
stateObject.dirty = self.dirty
|
||||
|
|
|
|||
|
|
@ -149,10 +149,11 @@ func TestSnapshot2(t *testing.T) {
|
|||
so0.balance = big.NewInt(42)
|
||||
so0.nonce = 43
|
||||
so0.SetCode([]byte{'c', 'a', 'f', 'e'})
|
||||
so0.remove = true
|
||||
so0.remove = false
|
||||
so0.deleted = false
|
||||
so0.dirty = false
|
||||
so0.dirty = true
|
||||
state.SetStateObject(so0)
|
||||
state.Commit()
|
||||
|
||||
// and one with deleted == true
|
||||
so1 := state.GetStateObject(stateobjaddr1)
|
||||
|
|
@ -173,6 +174,7 @@ func TestSnapshot2(t *testing.T) {
|
|||
state.Set(snapshot)
|
||||
|
||||
so0Restored := state.GetStateObject(stateobjaddr0)
|
||||
so0Restored.GetState(storageaddr)
|
||||
so1Restored := state.GetStateObject(stateobjaddr1)
|
||||
// non-deleted is equal (restored)
|
||||
compareStateObjects(so0Restored, so0, t)
|
||||
|
|
@ -198,9 +200,6 @@ func compareStateObjects(so0, so1 *StateObject, t *testing.T) {
|
|||
if !bytes.Equal(so0.code, so1.code) {
|
||||
t.Fatalf("Code mismatch: have %v, want %v", so0.code, so1.code)
|
||||
}
|
||||
if !bytes.Equal(so0.initCode, so1.initCode) {
|
||||
t.Fatalf("InitCode mismatch: have %v, want %v", so0.initCode, so1.initCode)
|
||||
}
|
||||
|
||||
for k, v := range so1.storage {
|
||||
if so0.storage[k] != v {
|
||||
|
|
|
|||
|
|
@ -324,7 +324,9 @@ func (self *StateDB) Copy() *StateDB {
|
|||
state, _ := New(common.Hash{}, self.db)
|
||||
state.trie = self.trie
|
||||
for k, stateObject := range self.stateObjects {
|
||||
state.stateObjects[k] = stateObject.Copy()
|
||||
if stateObject.dirty {
|
||||
state.stateObjects[k] = stateObject.Copy()
|
||||
}
|
||||
}
|
||||
|
||||
state.refund.Set(self.refund)
|
||||
|
|
@ -364,7 +366,6 @@ func (s *StateDB) IntermediateRoot() common.Hash {
|
|||
stateObject.Update()
|
||||
s.UpdateStateObject(stateObject)
|
||||
}
|
||||
stateObject.dirty = false
|
||||
}
|
||||
}
|
||||
return s.trie.Hash()
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@ type Config struct {
|
|||
Genesis string // Genesis JSON to seed the chain database with
|
||||
FastSync bool // Enables the state download based fast synchronisation algorithm
|
||||
|
||||
BlockChainVersion int
|
||||
SkipBcVersionCheck bool // e.g. blockchain export
|
||||
DatabaseCache int
|
||||
DatabaseHandles int
|
||||
|
|
@ -180,10 +179,10 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
|
|||
|
||||
if !config.SkipBcVersionCheck {
|
||||
bcVersion := core.GetBlockChainVersion(chainDb)
|
||||
if bcVersion != config.BlockChainVersion && bcVersion != 0 {
|
||||
return nil, fmt.Errorf("Blockchain DB version mismatch (%d / %d). Run geth upgradedb.\n", bcVersion, config.BlockChainVersion)
|
||||
if bcVersion != core.BlockChainVersion && bcVersion != 0 {
|
||||
return nil, fmt.Errorf("Blockchain DB version mismatch (%d / %d). Run geth upgradedb.\n", bcVersion, core.BlockChainVersion)
|
||||
}
|
||||
core.WriteBlockChainVersion(chainDb, config.BlockChainVersion)
|
||||
core.WriteBlockChainVersion(chainDb, core.BlockChainVersion)
|
||||
}
|
||||
|
||||
// load the genesis block or write a new one if no genesis
|
||||
|
|
|
|||
|
|
@ -79,8 +79,6 @@ type StateObject struct {
|
|||
codeHash []byte
|
||||
// The code for this account
|
||||
code Code
|
||||
// Temporarily initialisation code
|
||||
initCode Code
|
||||
// Cached storage (flushed when updated)
|
||||
storage Storage
|
||||
|
||||
|
|
@ -189,7 +187,6 @@ func (self *StateObject) Copy() *StateObject {
|
|||
stateObject.nonce = self.nonce
|
||||
stateObject.trie = self.trie
|
||||
stateObject.code = common.CopyBytes(self.code)
|
||||
stateObject.initCode = common.CopyBytes(self.initCode)
|
||||
stateObject.storage = self.storage.Copy()
|
||||
stateObject.remove = self.remove
|
||||
stateObject.dirty = self.dirty
|
||||
|
|
|
|||
Loading…
Reference in a new issue