mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-30 23:02:15 +00:00
Fix a bug that could cause us to fail the transition between downloading headers and blocks.
This commit is contained in:
parent
793254b6f5
commit
7b4dc184f7
@ -298,7 +298,8 @@ public class Peer {
|
||||
log.info("Passed the fast catchup time, discarding {} headers and requesting full blocks",
|
||||
m.getBlockHeaders().size() - i);
|
||||
downloadBlockBodies = true;
|
||||
blockChainDownload(header.getHash());
|
||||
lastGetBlocksBegin = Sha256Hash.ZERO_HASH; // Prevent this request being seen as a duplicate.
|
||||
blockChainDownload(Sha256Hash.ZERO_HASH);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,11 @@
|
||||
|
||||
package com.google.bitcoin.core;
|
||||
|
||||
import static org.easymock.EasyMock.*;
|
||||
import static org.junit.Assert.*;
|
||||
import com.google.bitcoin.core.Peer.PeerHandler;
|
||||
import org.easymock.Capture;
|
||||
import org.jboss.netty.channel.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
@ -26,12 +29,8 @@ import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import static com.google.bitcoin.core.TestUtils.*;
|
||||
import org.easymock.Capture;
|
||||
import org.jboss.netty.channel.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.bitcoin.core.Peer.PeerHandler;
|
||||
import static org.easymock.EasyMock.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class PeerTest extends TestWithNetworkConnections {
|
||||
private Peer peer;
|
||||
@ -422,7 +421,7 @@ public class PeerTest extends TestWithNetworkConnections {
|
||||
inbound(peer, headers);
|
||||
GetBlocksMessage getblocks = (GetBlocksMessage) event.getValue().getMessage();
|
||||
assertEquals(expectedLocator, getblocks.getLocator());
|
||||
assertEquals(b3.getHash(), getblocks.getStopHash());
|
||||
assertEquals(Sha256Hash.ZERO_HASH, getblocks.getStopHash());
|
||||
// We're supposed to get an inv here.
|
||||
InventoryMessage inv = new InventoryMessage(unitTestParams);
|
||||
inv.addItem(new InventoryItem(InventoryItem.Type.Block, b3.getHash()));
|
||||
|
Loading…
Reference in New Issue
Block a user