aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/block_chain.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethchain/block_chain.go')
-rw-r--r--ethchain/block_chain.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/ethchain/block_chain.go b/ethchain/block_chain.go
index 54f48bc60..5b55782a9 100644
--- a/ethchain/block_chain.go
+++ b/ethchain/block_chain.go
@@ -104,7 +104,6 @@ func (bc *BlockChain) GetChainFromHash(hash []byte, max uint64) []interface{} {
currentHash = block.PrevHash
chain = append(chain, block.Value().Val)
- //chain = append([]interface{}{block.RlpValue().Value}, chain...)
num--
}
@@ -141,7 +140,9 @@ func (bc *BlockChain) Add(block *Block) {
bc.CurrentBlock = block
bc.LastBlockHash = block.Hash()
- ethutil.Config.Db.Put(block.Hash(), block.RlpEncode())
+ encodedBlock := block.RlpEncode()
+ ethutil.Config.Db.Put(block.Hash(), encodedBlock)
+ ethutil.Config.Db.Put([]byte("LastBlock"), encodedBlock)
}
func (bc *BlockChain) GetBlock(hash []byte) *Block {
@@ -177,8 +178,6 @@ func (bc *BlockChain) writeBlockInfo(block *Block) {
func (bc *BlockChain) Stop() {
if bc.CurrentBlock != nil {
- ethutil.Config.Db.Put([]byte("LastBlock"), bc.CurrentBlock.RlpEncode())
-
log.Println("[CHAIN] Stopped")
}
}