core: force block process & fixed chain manager test

This commit is contained in:
obscuren
2015-04-20 16:02:50 +02:00
parent 97a9753f87
commit 72d065d491
3 changed files with 24 additions and 4 deletions

View File

@ -322,7 +322,12 @@ func (self *ChainManager) Export(w io.Writer) error {
last := self.currentBlock.NumberU64()
for nr := uint64(0); nr <= last; nr++ {
if err := self.GetBlockByNumber(nr).EncodeRLP(w); err != nil {
block := self.GetBlockByNumber(nr)
if block == nil {
return fmt.Errorf("export failed on #%d: not found", nr)
}
if err := block.EncodeRLP(w); err != nil {
return err
}
}