@Override public int hashCode() { return getAddr().hashCode() ^ port; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MasternodeAddress other = (MasternodeAddress) o; return other.getAddr().equals(getAddr()) && other.port == port; //TODO: including services and time could cause same peer to be added multiple times in collections }
public InetSocketAddress toSocketAddress() { return new InetSocketAddress(getAddr(), port); }
public InetSocketAddress getSocketAddress() { return new InetSocketAddress(getAddr(), getPort()); }
public MasternodeAddress duplicate() { return new MasternodeAddress(getAddr(), getPort()); } }
public void processMasternodeConnections() { //we don't care about this for regtest if(params.getId().equals(NetworkParameters.ID_REGTEST)) return; ReentrantLock nodeLock = context.peerGroup.getLock(); nodeLock.lock(); try { //BOOST_FOREACH(CNode * pnode, vNodes) for(Peer pnode : context.peerGroup.getConnectedPeers()) { if (pnode.isDarkSendMaster()) { if (context.darkSendPool.submittedToMasternode != null && pnode.getAddress().getAddr().equals(context.darkSendPool.submittedToMasternode.address.getAddr())) continue; log.info("Closing Masternode connection {}", pnode.getAddress()); pnode.fDarkSendMaster = false; //pnode.release();??? //TODO: not finished } } } finally { nodeLock.unlock(); } }
public Masternode(Masternode other) { super(other.params); this.context = other.context; //LOCK(cs); this.vin = other.vin; //TODO: need to make copies of all these? this.address = new MasternodeAddress(other.address.getAddr(), other.address.getPort()); this.pubKeyCollateralAddress = other.pubKeyCollateralAddress.duplicate(); this.pubKeyMasternode = other.pubKeyMasternode.duplicate(); //These are good this.sig = other.sig.duplicate(); this.activeState = other.activeState; this.sigTime = other.sigTime; this.cacheInputAge = other.cacheInputAge; this.cacheInputAgeBlock = other.cacheInputAgeBlock; this.unitTest = other.unitTest; this.allowFreeTx = other.allowFreeTx; this.protocolVersion = other.protocolVersion; this.nLastDsq = other.nLastDsq; this.nScanningErrorCount = other.nScanningErrorCount; this.nLastScanningErrorBlockHeight = other.nLastScanningErrorBlockHeight; }