Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
problem: RequireBlockchash MUST commit a hash
Browse files Browse the repository at this point in the history
solution: commit empty hash if no required block exists in db
  • Loading branch information
whilei committed May 10, 2018
1 parent 6c0ed19 commit d04d8c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/multivm_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ Loop:
vm.CommitNonexist(address)
case sputnikvm.RequireBlockhash:
number := ret.BlockNumber()
hash := common.Hash{}
if block := bc.GetBlockByNumber(number.Uint64()); block != nil && block.Number().Cmp(number) == 0 {
vm.CommitBlockhash(number, block.Hash())
hash = block.Hash()
}
vm.CommitBlockhash(number, hash)
}
}

Expand Down

0 comments on commit d04d8c1

Please sign in to comment.