aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/block_chain.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-02-18 08:33:26 +0800
committerobscuren <geffobscura@gmail.com>2014-02-18 08:33:26 +0800
commit68028f492f092f0546c2c084c1694ee6bf43b34e (patch)
tree010d789d7fdda9e6d5afcf6b1c8bddab079b2af9 /ethchain/block_chain.go
parent8629d9a4187c2027e565a50d763f949993ab169c (diff)
downloadgo-tangerine-68028f492f092f0546c2c084c1694ee6bf43b34e.tar
go-tangerine-68028f492f092f0546c2c084c1694ee6bf43b34e.tar.gz
go-tangerine-68028f492f092f0546c2c084c1694ee6bf43b34e.tar.bz2
go-tangerine-68028f492f092f0546c2c084c1694ee6bf43b34e.tar.lz
go-tangerine-68028f492f092f0546c2c084c1694ee6bf43b34e.tar.xz
go-tangerine-68028f492f092f0546c2c084c1694ee6bf43b34e.tar.zst
go-tangerine-68028f492f092f0546c2c084c1694ee6bf43b34e.zip
Fixed block handling
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")
}
}