From 99481a245adc2c4814ab6b38d94d63114f7bbb15 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 2 Dec 2014 11:37:33 +0100 Subject: Check for known block err and ignore --- chain/error.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'chain/error.go') diff --git a/chain/error.go b/chain/error.go index 540eda95a..7dce2b608 100644 --- a/chain/error.go +++ b/chain/error.go @@ -126,3 +126,16 @@ func IsTDError(e error) bool { _, ok := e.(*TDError) return ok } + +type KnownBlockError struct { + number uint64 + hash []byte +} + +func (self *KnownBlockError) Error() string { + return fmt.Sprintf("block %d already known (%x)", self.number, self.hash[0:4]) +} +func IsKnownBlockErr(e error) bool { + _, ok := e.(*KnownBlockError) + return ok +} -- cgit v1.2.3