core: Add BadHashErr and test for BadHashes handling

This commit is contained in:
Gustav Simonsson
2015-09-14 16:56:33 +02:00
parent 36f46a61a7
commit bfde1a4305
3 changed files with 66 additions and 2 deletions

View File

@ -177,3 +177,14 @@ func IsValueTransferErr(e error) bool {
_, ok := e.(*ValueTransferError)
return ok
}
type BadHashError common.Hash
func (h BadHashError) Error() string {
return fmt.Sprintf("Found known bad hash in chain %x", h)
}
func IsBadHashError(err error) bool {
_, ok := err.(BadHashError)
return ok
}