void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv) { // lite mode is not supported if(fLiteMode) return; if(!masternodeSync.IsBlockchainSynced()) return; if(pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) return; // ANOTHER USER IS ASKING US TO HELP THEM SYNC GOVERNANCE OBJECT DATA if (strCommand == NetMsgType::MNGOVERNANCESYNC) { // Ignore such requests until we are fully synced. // We could start processing this after masternode list is synced // but this is a heavy one so it's better to finish sync first. if (!masternodeSync.IsSynced()) return; uint256 nProp; CBloomFilter filter; vRecv >> nProp; if(pfrom->nVersion >= GOVERNANCE_FILTER_PROTO_VERSION) { vRecv >> filter; filter.UpdateEmptyFull(); } else {
void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman) { // lite mode is not supported if(fLiteMode) return; if(!masternodeSync.IsBlockchainSynced()) return; // ANOTHER USER IS ASKING US TO HELP THEM SYNC GOVERNANCE OBJECT DATA if (strCommand == NetMsgType::MNGOVERNANCESYNC) { if(pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) { LogPrint("gobject", "MNGOVERNANCESYNC -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion); connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_GOVERNANCE_PEER_PROTO_VERSION))); return; } // Ignore such requests until we are fully synced. // We could start processing this after masternode list is synced // but this is a heavy one so it's better to finish sync first. if (!masternodeSync.IsSynced()) return; uint256 nProp; CBloomFilter filter; vRecv >> nProp; if(pfrom->nVersion >= GOVERNANCE_FILTER_PROTO_VERSION) { vRecv >> filter; filter.UpdateEmptyFull(); } else {
void CMasternodeSync::SendGovernanceSyncRequest(CNode* pnode, CConnman& connman) { const CNetMsgMaker msgMaker(pnode->GetSendVersion()); if(pnode->nVersion >= GOVERNANCE_FILTER_PROTO_VERSION) { CBloomFilter filter; filter.clear(); connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MNGOVERNANCESYNC, uint256(), filter)); // connman.PushMessage(pnode, NetMsgType::MNGOVERNANCESYNC, uint256(), filter); } else { connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MNGOVERNANCESYNC, uint256())); // connman.PushMessage(pnode, NetMsgType::MNGOVERNANCESYNC, uint256()); } }
CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter& filter) { header = block.GetBlockHeader(); vector<bool> vMatch; vector<uint256> vHashes; vMatch.reserve(block.vtx.size()); vHashes.reserve(block.vtx.size()); for (unsigned int i = 0; i < block.vtx.size(); i++) { const uint256& hash = block.vtx[i].GetHash(); if (filter.IsRelevantAndUpdate(block.vtx[i])) { vMatch.push_back(true); vMatchedTxn.push_back(make_pair(i, hash)); } else vMatch.push_back(false); vHashes.push_back(hash); } txn = CPartialMerkleTree(vHashes, vMatch); }
int AddBlockMintsToAccumulator(const CoinDenomination den, const CBloomFilter filter, const CBlockIndex* pindex, libzerocoin::Accumulator* accumulator, bool isWitness, list<CBigNum>& notAddedCoins) { // if this block contains mints of the denomination that is being spent, then add them to the witness int nMintsAdded = 0; if (pindex->MintedDenomination(den)) { //add the mints to the witness for (const PublicCoin& pubcoin : GetPubcoinFromBlock(pindex)) { if (pubcoin.getDenomination() != den) { continue; } if (isWitness && filter.contains(pubcoin.getValue().getvch())) { notAddedCoins.emplace_back(pubcoin.getValue()); continue; } accumulator->increment(pubcoin.getValue()); ++nMintsAdded; } } return nMintsAdded; }