Used wrong nonce for version message

This commit is contained in:
Christian Basler 2016-08-09 19:50:11 +02:00
parent 505818a712
commit cd3a801704
3 changed files with 8 additions and 8 deletions

View File

@ -146,7 +146,7 @@ public abstract class AbstractConnection {
List<InventoryVector> missing = ctx.getInventory().getMissing(inv.getInventory(), streams);
missing.removeAll(commonRequestedObjects);
LOG.debug("Received inventory with " + originalSize + " elements, of which are "
+ missing.size() + " missing.");
+ missing.size() + " missing.");
send(new GetData.Builder().inventory(missing).build());
}
@ -197,8 +197,8 @@ public abstract class AbstractConnection {
public void offer(InventoryVector iv) {
sendingQueue.offer(new Inv.Builder()
.addInventoryVector(iv)
.build());
.addInventoryVector(iv)
.build());
updateIvCache(Collections.singletonList(iv));
}
@ -235,7 +235,7 @@ public abstract class AbstractConnection {
break;
default:
throw new NodeException("Command 'version' or 'verack' expected, but was '"
+ payload.getCommand() + "'");
+ payload.getCommand() + "'");
}
}
@ -259,8 +259,8 @@ public abstract class AbstractConnection {
List<InventoryVector> inventory = ctx.getInventory().getInventory(streams);
for (int i = 0; i < inventory.size(); i += 50000) {
sendingQueue.offer(new Inv.Builder()
.inventory(inventory.subList(i, Math.min(inventory.size(), i + 50000)))
.build());
.inventory(inventory.subList(i, Math.min(inventory.size(), i + 50000)))
.build());
}
}

View File

@ -162,7 +162,7 @@ class Connection extends AbstractConnection {
try (Socket socket = Connection.this.socket) {
initSocket(socket);
if (mode == CLIENT || mode == SYNC) {
send(new Version.Builder().defaults(peerNonce).addrFrom(host).addrRecv(node).build());
send(new Version.Builder().defaults(ctx.getClientNonce()).addrFrom(host).addrRecv(node).build());
}
while (state != DISCONNECTED) {
if (mode != SYNC) {

View File

@ -52,7 +52,7 @@ public class ConnectionInfo extends AbstractConnection {
super(context, mode, node, listener, commonRequestedObjects, syncTimeout);
headerOut.flip();
if (mode == CLIENT || mode == SYNC) {
send(new Version.Builder().defaults(peerNonce).addrFrom(host).addrRecv(node).build());
send(new Version.Builder().defaults(ctx.getClientNonce()).addrFrom(host).addrRecv(node).build());
}
}