3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-01 07:42:17 +00:00

Fix a minor bug in AddressMessage. Patch from Vasile Rotaru. Resolves issue 138.

This commit is contained in:
Mike Hearn 2012-02-10 16:44:57 +01:00
parent 03db1a9636
commit 21c5e14700
2 changed files with 4 additions and 4 deletions

View File

@ -12,3 +12,4 @@ Jonny Heggheim <hegjon@gmail.com>
Steve Coughlan <shadders.del@gmail.com>
Roman Mandeleil <roman.mandeleil@gmail.com>
Chris Rico <chrisrico@gmail.com>
Vasile Rotaru <vrotaru.md@gmail.com>

View File

@ -89,14 +89,13 @@ public class AddressMessage extends Message {
for (PeerAddress addr : addresses) {
addr.bitcoinSerialize(stream);
}
}
int getMessageSize() {
if (length != UNKNOWN_LENGTH)
return length;
length = new VarInt(addresses.size()).getSizeInBytes();
if (addresses != null) {
length = new VarInt(addresses.size()).getSizeInBytes();
// The 4 byte difference is the uint32 timestamp that was introduced in version 31402
length += addresses.size() * (protocolVersion > 31402 ? PeerAddress.MESSAGE_SIZE : PeerAddress.MESSAGE_SIZE - 4);
}