From 011025dc0dc47367f7fa8aa314f0d9c72d69e2e9 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 12 Dec 2013 18:10:06 -0600 Subject: [PATCH] Fix regtest mode with new headers-first approach. The regression test does not work properly with the new headers-first download approach, so force the old inv-based block download for regression test mode. --- blockmanager.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/blockmanager.go b/blockmanager.go index 55239167..95fabb67 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -152,11 +152,12 @@ func (b *blockManager) startSync(peers *list.List) { bmgrLog.Infof("Syncing to block height %d from peer %v", bestPeer.lastBlock, bestPeer.addr) - // if starting from the beginning fetch headers and - // download blocks based on that, otherwise compute - // the block download via inv messages. - - if height == 0 { + // if starting from the beginning fetch headers and download + // blocks based on that, otherwise compute the block download + // via inv messages. Regression test mode does not support the + // headers-first approach so do normal block downloads when in + // regression test mode. + if height == 0 && !cfg.RegressionTest { bestPeer.PushGetHeadersMsg(locator) b.fetchingHeaders = true } else {