core: support inserting pure header chains

This commit is contained in:
Péter Szilágyi
2015-09-21 15:36:29 +03:00
parent 92f9a3e5fa
commit c33cc382b3
9 changed files with 653 additions and 348 deletions

View File

@ -160,7 +160,8 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
return
}
// Make sure the peer's TD is higher than our own. If not drop.
if peer.Td().Cmp(pm.blockchain.Td()) <= 0 {
td := pm.blockchain.GetTd(pm.blockchain.CurrentBlock().Hash())
if peer.Td().Cmp(td) <= 0 {
return
}
// Otherwise try to sync with the downloader