Correct the addblock utility import.

This commit corrects the check in the addblock utility to check each block
links the previous hash as intended versus the current block.

Fixes #162.
This commit is contained in:
Dave Collins 2014-08-11 01:52:34 -05:00
parent ece3ed8443
commit 74386998be

View file

@ -119,14 +119,14 @@ func (bi *blockImporter) processBlock(serializedBlock []byte) (bool, error) {
// Don't bother trying to process orphans.
prevHash := &block.MsgBlock().Header.PrevBlock
if !prevHash.IsEqual(&zeroHash) {
exists, err := bi.db.ExistsSha(blockSha)
exists, err := bi.db.ExistsSha(prevHash)
if err != nil {
return false, err
}
if !exists {
return false, fmt.Errorf("import file contains block "+
"%v which does not link to the available "+
"block chain", blockSha)
"block chain", prevHash)
}
}