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:
parent
ece3ed8443
commit
74386998be
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue