mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-19 18:00:39 +01:00
VersionMessage: serialize negative time
values
Surprisingly, version messages serialize time as a `int64_t` (signed 64-bit integer).
This commit is contained in:
parent
7a0939f7e4
commit
5bb1e123b6
@ -130,7 +130,7 @@ public class VersionMessage extends Message {
|
||||
protected void parse() throws ProtocolException {
|
||||
clientVersion = (int) readUint32();
|
||||
localServices = readUint64().longValue();
|
||||
time = Instant.ofEpochSecond(readUint64().longValue());
|
||||
time = Instant.ofEpochSecond(readInt64());
|
||||
receivingAddr = new PeerAddress(params, payload, this, serializer.withProtocolVersion(0));
|
||||
if (clientVersion >= 106) {
|
||||
fromAddr = new PeerAddress(params, payload, this, serializer.withProtocolVersion(0));
|
||||
@ -162,9 +162,7 @@ public class VersionMessage extends Message {
|
||||
ByteUtils.writeUint32LE(clientVersion, buf);
|
||||
ByteUtils.writeUint32LE(localServices, buf);
|
||||
ByteUtils.writeUint32LE(localServices >> 32, buf);
|
||||
long time = this.time.getEpochSecond();
|
||||
ByteUtils.writeUint32LE(time, buf);
|
||||
ByteUtils.writeUint32LE(time >> 32, buf);
|
||||
ByteUtils.writeInt64LE(time.getEpochSecond(), buf);
|
||||
receivingAddr.bitcoinSerializeToStream(buf);
|
||||
fromAddr.bitcoinSerializeToStream(buf);
|
||||
// Next up is the "local host nonce", this is to detect the case of connecting
|
||||
|
Loading…
Reference in New Issue
Block a user