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