mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 11:15:51 +00:00
Follow the protocol change that occurs on Feb 20th
This commit is contained in:
parent
c7fd805e47
commit
8be3a7a027
@ -50,6 +50,7 @@ public class TCPNetworkConnection implements NetworkConnection {
|
|||||||
// Given to the BitcoinSerializer to de-duplicate messages.
|
// Given to the BitcoinSerializer to de-duplicate messages.
|
||||||
private static final LinkedHashMap<Sha256Hash, Integer> dedupeList = BitcoinSerializer.createDedupeList();
|
private static final LinkedHashMap<Sha256Hash, Integer> dedupeList = BitcoinSerializer.createDedupeList();
|
||||||
private BitcoinSerializer serializer = null;
|
private BitcoinSerializer serializer = null;
|
||||||
|
private static final Date checksummingProtocolChangeDate = new Date(1329696000000L);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to the given IP address using the port specified as part of the network parameters. Once construction
|
* Connect to the given IP address using the port specified as part of the network parameters. Once construction
|
||||||
@ -79,8 +80,10 @@ public class TCPNetworkConnection implements NetworkConnection {
|
|||||||
out = socket.getOutputStream();
|
out = socket.getOutputStream();
|
||||||
in = socket.getInputStream();
|
in = socket.getInputStream();
|
||||||
|
|
||||||
// The version message never uses checksumming. Update checkumming property after version is read.
|
// The version message does not use checksumming, until Feb 2012 when it magically does.
|
||||||
|
// So pre-Feb 2012, update checkumming property after version is read.
|
||||||
this.serializer = new BitcoinSerializer(params, false, dedupe ? dedupeList : null);
|
this.serializer = new BitcoinSerializer(params, false, dedupe ? dedupeList : null);
|
||||||
|
this.serializer.setUseChecksumming(Utils.now().after(checksummingProtocolChangeDate));
|
||||||
|
|
||||||
// Announce ourselves. This has to come first to connect to clients beyond v0.30.20.2 which wait to hear
|
// Announce ourselves. This has to come first to connect to clients beyond v0.30.20.2 which wait to hear
|
||||||
// from us until they send their version message back.
|
// from us until they send their version message back.
|
||||||
@ -118,7 +121,7 @@ public class TCPNetworkConnection implements NetworkConnection {
|
|||||||
}
|
}
|
||||||
throw new ProtocolException("Peer does not have a copy of the block chain.");
|
throw new ProtocolException("Peer does not have a copy of the block chain.");
|
||||||
}
|
}
|
||||||
// newer clients use checksumming
|
// Newer clients use checksumming.
|
||||||
serializer.setUseChecksumming(peerVersion >= 209);
|
serializer.setUseChecksumming(peerVersion >= 209);
|
||||||
// Handshake is done!
|
// Handshake is done!
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user