aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain
diff options
context:
space:
mode:
Diffstat (limited to 'ethchain')
-rw-r--r--ethchain/block_chain.go34
-rw-r--r--ethchain/state_transition.go9
-rw-r--r--ethchain/types.go18
3 files changed, 30 insertions, 31 deletions
diff --git a/ethchain/block_chain.go b/ethchain/block_chain.go
index 467c54058..113e313ac 100644
--- a/ethchain/block_chain.go
+++ b/ethchain/block_chain.go
@@ -78,6 +78,22 @@ func (bc *BlockChain) NewBlock(coinbase []byte) *Block {
return block
}
+func (bc *BlockChain) Reset() {
+ AddTestNetFunds(bc.genesisBlock)
+
+ bc.genesisBlock.state.Trie.Sync()
+ // Prepare the genesis block
+ bc.Add(bc.genesisBlock)
+ fk := append([]byte("bloom"), bc.genesisBlock.Hash()...)
+ bc.Ethereum.Db().Put(fk, make([]byte, 255))
+ bc.CurrentBlock = bc.genesisBlock
+
+ bc.SetTotalDifficulty(ethutil.Big("0"))
+
+ // Set the last know difficulty (might be 0x0 as initial value, Genesis)
+ bc.TD = ethutil.BigD(ethutil.Config.Db.LastKnownTD())
+}
+
func (bc *BlockChain) HasBlock(hash []byte) bool {
data, _ := ethutil.Config.Db.Get(hash)
return len(data) != 0
@@ -149,28 +165,22 @@ func AddTestNetFunds(block *Block) {
}
func (bc *BlockChain) setLastBlock() {
- // Prep genesis
- AddTestNetFunds(bc.genesisBlock)
-
data, _ := ethutil.Config.Db.Get([]byte("LastBlock"))
if len(data) != 0 {
+ // Prep genesis
+ AddTestNetFunds(bc.genesisBlock)
+
block := NewBlockFromBytes(data)
bc.CurrentBlock = block
bc.LastBlockHash = block.Hash()
bc.LastBlockNumber = block.Number.Uint64()
+ // Set the last know difficulty (might be 0x0 as initial value, Genesis)
+ bc.TD = ethutil.BigD(ethutil.Config.Db.LastKnownTD())
} else {
- bc.genesisBlock.state.Trie.Sync()
- // Prepare the genesis block
- bc.Add(bc.genesisBlock)
- fk := append([]byte("bloom"), bc.genesisBlock.Hash()...)
- bc.Ethereum.Db().Put(fk, make([]byte, 255))
- bc.CurrentBlock = bc.genesisBlock
+ bc.Reset()
}
- // Set the last know difficulty (might be 0x0 as initial value, Genesis)
- bc.TD = ethutil.BigD(ethutil.Config.Db.LastKnownTD())
-
chainlogger.Infof("Last block (#%d) %x\n", bc.LastBlockNumber, bc.CurrentBlock.Hash())
}
diff --git a/ethchain/state_transition.go b/ethchain/state_transition.go
index fbb729950..28cb66105 100644
--- a/ethchain/state_transition.go
+++ b/ethchain/state_transition.go
@@ -276,15 +276,6 @@ func (self *StateTransition) Eval(msg *ethstate.Message, script []byte, context
ret, _, err = callerClosure.Call(vm, self.tx.Data)
- if err == nil {
- // Execute POSTs
- for e := vm.Queue().Front(); e != nil; e = e.Next() {
- msg := e.Value.(*ethvm.Message)
-
- msg.Exec(msg.Addr(), transactor)
- }
- }
-
return
}
diff --git a/ethchain/types.go b/ethchain/types.go
index 45486b06c..ccd5b7975 100644
--- a/ethchain/types.go
+++ b/ethchain/types.go
@@ -144,11 +144,10 @@ const (
SWAP16 = 0x9f
// 0xf0 range - closures
- CREATE = 0xf0
- CALL = 0xf1
- RETURN = 0xf2
- POST = 0xf3
- CALLSTATELESS = 0xf4
+ CREATE = 0xf0
+ CALL = 0xf1
+ RETURN = 0xf2
+ CALLCODE = 0xf3
// 0x70 range - other
LOG = 0xfe // XXX Unofficial
@@ -293,11 +292,10 @@ var opCodeToString = map[OpCode]string{
SWAP16: "SWAP16",
// 0xf0 range
- CREATE: "CREATE",
- CALL: "CALL",
- RETURN: "RETURN",
- POST: "POST",
- CALLSTATELESS: "CALLSTATELESS",
+ CREATE: "CREATE",
+ CALL: "CALL",
+ RETURN: "RETURN",
+ CALLCODE: "CALLCODE",
// 0x70 range - other
LOG: "LOG",