From db840035a85cac218d1104f4e8542fe8cea3fe5d Mon Sep 17 00:00:00 2001 From: Varunram Date: Fri, 23 Nov 2018 12:21:21 +0530 Subject: [PATCH] resolve bug where reorging greater than attachheight requires db wipe --- uspv/header.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/uspv/header.go b/uspv/header.go index 8861cb079..1e9e0345e 100644 --- a/uspv/header.go +++ b/uspv/header.go @@ -312,6 +312,10 @@ func CheckHeaderChain( // reorg is go, snip to attach height reorgDepth := height - attachHeight + if reorgDepth > numheaders { + logging.Info("Reorg depth is greater than the number of headers received, exiting!") + return 0, fmt.Errorf("Reorg depth is greater than the number of headers received, exiting!") + } oldHeaders = oldHeaders[:numheaders-reorgDepth] }