public int getTransactionLockSignatures(Sha256Hash txHash) { //if(fLargeWorkForkFound || fLargeWorkInvalidChainFound) return -2; if(!context.sporkManager.isSporkActive(SPORK_2_INSTANTSEND_ENABLED)) return -3; if(!context.allowInstantXinLiteMode()) return -1; TransactionLock tlock = mapTxLocks.get(txHash); if (tlock != null){ return tlock.countSignatures(); } return -1; }
boolean isLockedInstantSendTransaction(Sha256Hash txHash) { if(!context.allowInstantXinLiteMode() /*|| fLargeWorkForkFound || fLargeWorkInvalidChainFound */|| !context.sporkManager.isSporkActive(SPORK_3_INSTANTSEND_BLOCK_FILTERING)) return false; try { lock.lock(); // there must be a lock candidate TransactionLockCandidate lockCandidate = mapTxLockCandidates.get(txHash); if (lockCandidate == null) return false; // which should have outpoints if (lockCandidate.mapOutPointLocks.size() == 0) return false; // and all of these outputs must be included in mapLockedOutpoints with correct hash Iterator<Map.Entry<TransactionOutPoint, TransactionOutPointLock>> it = lockCandidate.mapOutPointLocks.entrySet().iterator(); while(it.hasNext()) { Map.Entry<TransactionOutPoint, TransactionOutPointLock> tt = it.next(); Sha256Hash hashLocked = getLockedOutPointTxHash(tt.getKey()); if (hashLocked == null || hashLocked != txHash) return false; } return true; } finally { lock.unlock(); } }
public boolean isTransactionLockTimedOut(Sha256Hash txHash) { if(!context.allowInstantXinLiteMode()) return false; try { lock.lock(); TransactionLockCandidate lockCandidate = mapTxLockCandidates.get(txHash); if (lockCandidate != null) { return !lockCandidate.isAllOutPointsReady() && lockCandidate.isTimedOut(); } return false; } finally { lock.unlock(); } }
boolean canProcessInstantXMessages() { if(context.isLiteMode() && !context.allowInstantXinLiteMode()) return false; //disable all darksend/masternode related functionality if(!context.sporkManager.isSporkActive(SPORK_2_INSTANTSEND_ENABLED)) return false; if(!context.masternodeSync.isBlockchainSynced()) return false; return true; }
void processSpork(Peer from, SporkMessage spork) { if (context.isLiteMode() && !context.allowInstantXinLiteMode()) return; //disable all darksend/masternode related functionality Sha256Hash hash = spork.getHash(); if (mapSporksActive.containsKey(spork.nSporkID)) { if (mapSporksActive.get(spork.nSporkID).nTimeSigned >= spork.nTimeSigned) { log.info("spork - seen "+hash.toString()+" block " + blockChain.getBestChainHeight()); return; } else { log.info("spork - got updated spork "+hash.toString()+" block " +blockChain.getBestChainHeight()); } } log.info("spork - new "+hash.toString()+" ID "+spork.nSporkID+" Time "+spork.nTimeSigned+" bestHeight" + blockChain.getBestChainHeight()); if (!spork.checkSignature(sporkPubKeyId)) { log.info("spork - invalid signature"); //Misbehaving(pfrom -> GetId(), 100); return; } mapSporks.put(hash, spork); mapSporksActive.put(spork.nSporkID, spork); relay(spork); //does a task if needed executeSpork(spork.nSporkID, spork.nValue); } /*
@Override public void run() { if(context.isLiteMode() && !context.allowInstantXinLiteMode()) return; //disable all Darksend/Masternode related functionality
if(context.isLiteMode() && context.allowInstantXinLiteMode()) { RequestedMasternodeAssets = MASTERNODE_SYNC_FINISHED; queueOnSyncStatusChanged(RequestedMasternodeAssets, 1.0);