예제 #1
0
  @Override
  public void setUp(BlockStore blockStore) throws Exception {
    super.setUp(blockStore);

    remoteVersionMessage = new VersionMessage(unitTestParams, 1);
    remoteVersionMessage.localServices = VersionMessage.NODE_NETWORK;
    remoteVersionMessage.clientVersion = NotFoundMessage.MIN_PROTOCOL_VERSION;
    blockJobs = false;
    initPeerGroup();
  }
예제 #2
0
 private void stepThroughInit(VersionMessage versionMessage, InboundMessageQueuer writeTarget)
     throws InterruptedException {
   checkState(writeTarget.nextMessageBlocking() instanceof VersionMessage);
   checkState(writeTarget.nextMessageBlocking() instanceof VersionAck);
   if (versionMessage.isBloomFilteringSupported()) {
     checkState(writeTarget.nextMessageBlocking() instanceof BloomFilter);
     checkState(writeTarget.nextMessageBlocking() instanceof MemoryPoolMessage);
   }
 }
예제 #3
0
 // handle peer discovered by PeerGroup
 protected InboundMessageQueuer handleConnectToPeer(int id, VersionMessage versionMessage)
     throws Exception {
   InboundMessageQueuer writeTarget = newPeerWriteTargetQueue.take();
   checkArgument(versionMessage.hasBlockChain());
   // Complete handshake with the peer - send/receive version(ack)s, receive bloom filter
   writeTarget.sendMessage(versionMessage);
   writeTarget.sendMessage(new VersionAck());
   stepThroughInit(versionMessage, writeTarget);
   return writeTarget;
 }
예제 #4
0
 protected InboundMessageQueuer connectPeer(int id, VersionMessage versionMessage)
     throws Exception {
   checkArgument(versionMessage.hasBlockChain());
   InboundMessageQueuer writeTarget = connectPeerWithoutVersionExchange(id);
   // Complete handshake with the peer - send/receive version(ack)s, receive bloom filter
   writeTarget.sendMessage(versionMessage);
   writeTarget.sendMessage(new VersionAck());
   stepThroughInit(versionMessage, writeTarget);
   return writeTarget;
 }