Regtest+Darksend / Dsee update / vecMasternodes

- Made masternodes/darksend compatible with regression testing mode (a local-only blockchain that doesn't require mining). Developers can now test multiple rounds in a few minutes without waiting on mining (much faster).
- Added dsee security verification to v11
- darkSendMasternodes -> vecMasternodes (must clearer)
This commit is contained in:
Evan Duffield 2014-12-30 19:54:00 -07:00
parent a290bc06f2
commit 826b18c41f
14 changed files with 507 additions and 482 deletions

View File

@ -200,7 +200,7 @@ bool CActiveMasternode::Dseep(CTxIn vin, CService service, CKey keyMasternode, C
// Update Last Seen timestamp in masternode list
bool found = false;
BOOST_FOREACH(CMasterNode& mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode& mn, vecMasternodes) {
//LogPrintf(" -- %s\n", mn.vin.ToString().c_str());
if(mn.vin == vin) {
found = true;
@ -269,7 +269,7 @@ bool CActiveMasternode::Register(CTxIn vin, CService service, CKey keyCollateral
}
bool found = false;
BOOST_FOREACH(CMasterNode& mn, darkSendMasterNodes)
BOOST_FOREACH(CMasterNode& mn, vecMasternodes)
if(mn.vin == vin)
found = true;
@ -277,7 +277,7 @@ bool CActiveMasternode::Register(CTxIn vin, CService service, CKey keyCollateral
LogPrintf("CActiveMasternode::Register() - Adding to masternode list service: %s - vin: %s\n", service.ToString().c_str(), vin.ToString().c_str());
CMasterNode mn(service, vin, pubKeyCollateralAddress, vchMasterNodeSignature, masterNodeSignatureTime, pubKeyMasternode, PROTOCOL_VERSION);
mn.UpdateLastSeen(masterNodeSignatureTime);
darkSendMasterNodes.push_back(mn);
vecMasternodes.push_back(mn);
}
//send to all peers

View File

@ -47,7 +47,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
return;
}
if(darkSendPool.submittedToMasternode != pfrom->addr){
if((CNetAddr)darkSendPool.submittedToMasternode != (CNetAddr)pfrom->addr){
//LogPrintf("dsc - message doesn't match current masternode - %s != %s\n", darkSendPool.submittedToMasternode.ToString().c_str(), pfrom->addr.ToString().c_str());
return;
}
@ -70,7 +70,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
return;
}
if(darkSendPool.submittedToMasternode != pfrom->addr){
if((CNetAddr)darkSendPool.submittedToMasternode != (CNetAddr)pfrom->addr){
//LogPrintf("dsc - message doesn't match current masternode - %s != %s\n", darkSendPool.submittedToMasternode.ToString().c_str(), pfrom->addr.ToString().c_str());
return;
}
@ -118,9 +118,9 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
}
if(darkSendPool.sessionUsers == 0) {
if(darkSendMasterNodes[mn].nLastDsq != 0 &&
darkSendMasterNodes[mn].nLastDsq + CountMasternodesAboveProtocol(darkSendPool.MIN_PEER_PROTO_VERSION)/5 > darkSendPool.nDsqCount){
//LogPrintf("dsa -- last dsq too recent, must wait. %s \n", darkSendMasterNodes[mn].addr.ToString().c_str());
if(vecMasternodes[mn].nLastDsq != 0 &&
vecMasternodes[mn].nLastDsq + CountMasternodesAboveProtocol(darkSendPool.MIN_PEER_PROTO_VERSION)/5 > darkSendPool.nDsqCount){
//LogPrintf("dsa -- last dsq too recent, must wait. %s \n", vecMasternodes[mn].addr.ToString().c_str());
std::string strError = "Last darksend was too recent";
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_REJECTED, strError);
return;
@ -157,7 +157,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
// if the queue is ready, submit if we can
if(dsq.ready) {
if(darkSendPool.submittedToMasternode != addr){
if((CNetAddr)darkSendPool.submittedToMasternode != (CNetAddr)addr){
LogPrintf("dsq - message doesn't match current masternode - %s != %s\n", darkSendPool.submittedToMasternode.ToString().c_str(), pfrom->addr.ToString().c_str());
return;
}
@ -169,16 +169,16 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
if(q.vin == dsq.vin) return;
}
if(fDebug) LogPrintf("dsq last %d last2 %d count %d\n", darkSendMasterNodes[mn].nLastDsq, darkSendMasterNodes[mn].nLastDsq + (int)darkSendMasterNodes.size()/5, darkSendPool.nDsqCount);
if(fDebug) LogPrintf("dsq last %d last2 %d count %d\n", vecMasternodes[mn].nLastDsq, vecMasternodes[mn].nLastDsq + (int)vecMasternodes.size()/5, darkSendPool.nDsqCount);
//don't allow a few nodes to dominate the queuing process
if(darkSendMasterNodes[mn].nLastDsq != 0 &&
darkSendMasterNodes[mn].nLastDsq + CountMasternodesAboveProtocol(darkSendPool.MIN_PEER_PROTO_VERSION)/5 > darkSendPool.nDsqCount){
if(fDebug) LogPrintf("dsq -- masternode sending too many dsq messages. %s \n", darkSendMasterNodes[mn].addr.ToString().c_str());
if(vecMasternodes[mn].nLastDsq != 0 &&
vecMasternodes[mn].nLastDsq + CountMasternodesAboveProtocol(darkSendPool.MIN_PEER_PROTO_VERSION)/5 > darkSendPool.nDsqCount){
if(fDebug) LogPrintf("dsq -- masternode sending too many dsq messages. %s \n", vecMasternodes[mn].addr.ToString().c_str());
return;
}
darkSendPool.nDsqCount++;
darkSendMasterNodes[mn].nLastDsq = darkSendPool.nDsqCount;
darkSendMasterNodes[mn].allowFreeTx = true;
vecMasternodes[mn].nLastDsq = darkSendPool.nDsqCount;
vecMasternodes[mn].allowFreeTx = true;
if(fDebug) LogPrintf("dsq - new darksend queue object - %s\n", addr.ToString().c_str());
vecDarksendQueue.push_back(dsq);
@ -326,7 +326,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
return;
}
if(darkSendPool.submittedToMasternode != pfrom->addr){
if((CNetAddr)darkSendPool.submittedToMasternode != (CNetAddr)pfrom->addr){
//LogPrintf("dssu - message doesn't match current masternode - %s != %s\n", darkSendPool.submittedToMasternode.ToString().c_str(), pfrom->addr.ToString().c_str());
return;
}
@ -1419,7 +1419,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
}
}
if(darkSendMasterNodes.size() == 0){
if(vecMasternodes.size() == 0){
if(fDebug) LogPrintf("CDarkSendPool::DoAutomaticDenominating - No masternodes detected\n");
strAutoDenomResult = "No masternodes detected";
return false;
@ -1568,7 +1568,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
if(submittedToMasternode != pnode->addr) continue;
if((CNetAddr)pnode->addr != (CNetAddr)submittedToMasternode) continue;
std::string strReason;
if(txCollateral == CTransaction()){
@ -1599,33 +1599,33 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
// otherwise, try one randomly
if(sessionTries++ < 10){
//pick a random masternode to use
int max_value = darkSendMasterNodes.size();
int max_value = vecMasternodes.size();
if(max_value <= 0) return false;
int i = (rand() % max_value);
//don't reuse masternodes
BOOST_FOREACH(CTxIn usedVin, vecMasternodesUsed) {
if(darkSendMasterNodes[i].vin == usedVin){
if(vecMasternodes[i].vin == usedVin){
return DoAutomaticDenominating();
}
}
if(darkSendMasterNodes[i].protocolVersion < MIN_PEER_PROTO_VERSION) {
if(vecMasternodes[i].protocolVersion < MIN_PEER_PROTO_VERSION) {
return DoAutomaticDenominating();
}
if(darkSendMasterNodes[i].nLastDsq != 0 &&
darkSendMasterNodes[i].nLastDsq + CountMasternodesAboveProtocol(darkSendPool.MIN_PEER_PROTO_VERSION)/5 > darkSendPool.nDsqCount){
if(vecMasternodes[i].nLastDsq != 0 &&
vecMasternodes[i].nLastDsq + CountMasternodesAboveProtocol(darkSendPool.MIN_PEER_PROTO_VERSION)/5 > darkSendPool.nDsqCount){
return DoAutomaticDenominating();
}
lastTimeChanged = GetTimeMillis();
LogPrintf("DoAutomaticDenominating -- attempt %d connection to masternode %s\n", sessionTries, darkSendMasterNodes[i].addr.ToString().c_str());
if(ConnectNode((CAddress)darkSendMasterNodes[i].addr, NULL, true)){
submittedToMasternode = darkSendMasterNodes[i].addr;
LogPrintf("DoAutomaticDenominating -- attempt %d connection to masternode %s\n", sessionTries, vecMasternodes[i].addr.ToString().c_str());
if(ConnectNode((CAddress)vecMasternodes[i].addr, NULL, true)){
submittedToMasternode = vecMasternodes[i].addr;
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
if(darkSendMasterNodes[i].addr != pnode->addr) continue;
if((CNetAddr)pnode->addr != (CNetAddr)vecMasternodes[i].addr) continue;
std::string strReason;
if(txCollateral == CTransaction()){
@ -1635,7 +1635,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
}
}
vecMasternodesUsed.push_back(darkSendMasterNodes[i].vin);
vecMasternodesUsed.push_back(vecMasternodes[i].vin);
if(sessionMinRounds >= 0){
//use same denominations
@ -2120,7 +2120,7 @@ bool CDarksendQueue::Relay()
bool CDarksendQueue::CheckSignature()
{
BOOST_FOREACH(CMasterNode& mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode& mn, vecMasternodes) {
if(mn.vin == vin) {
std::string strMessage = vin.ToString() + boost::lexical_cast<std::string>(nDenom) + boost::lexical_cast<std::string>(time) + boost::lexical_cast<std::string>(ready);
@ -2155,12 +2155,12 @@ void ThreadCheckDarkSendPool()
darkSendPool.CheckTimeout();
if(c % 60 == 0){
vector<CMasterNode>::iterator it = darkSendMasterNodes.begin();
while(it != darkSendMasterNodes.end()){
vector<CMasterNode>::iterator it = vecMasternodes.begin();
while(it != vecMasternodes.end()){
(*it).Check();
if((*it).enabled == 4 || (*it).enabled == 3){
LogPrintf("Removing inactive masternode %s\n", (*it).addr.ToString().c_str());
it = darkSendMasterNodes.erase(it);
it = vecMasternodes.erase(it);
} else {
++it;
}
@ -2200,7 +2200,7 @@ void ThreadCheckDarkSendPool()
if(c % 60 == 0){
//if we've used 1/5 of the masternode list, then clear the list.
if((int)vecMasternodesUsed.size() > (int)darkSendMasterNodes.size() / 5)
if((int)vecMasternodesUsed.size() > (int)vecMasternodes.size() / 5)
vecMasternodesUsed.clear();
}

View File

@ -158,7 +158,7 @@ public:
bool GetAddress(CService &addr)
{
BOOST_FOREACH(CMasterNode mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode mn, vecMasternodes) {
if(mn.vin == vin){
addr = mn.addr;
return true;
@ -169,7 +169,7 @@ public:
bool GetProtocolVersion(int &protocolVersion)
{
BOOST_FOREACH(CMasterNode mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode mn, vecMasternodes) {
if(mn.vin == vin){
protocolVersion = mn.protocolVersion;
return true;
@ -283,7 +283,7 @@ public:
to behave themselves. If they don't it takes their money. */
std::string strAddress = "";
if(!(Params().NetworkID() == CChainParams::TESTNET)) {
if(Params().NetworkID() == CChainParams::MAIN) {
strAddress = "Xq19GqFvajRrEdDHYRKGYjTsQfpV5jyipF";
} else {
strAddress = "y1EZuxhhNMAUofTBEeLqGE1bJrpC2TWRNp";
@ -369,7 +369,7 @@ public:
int GetMaxPoolTransactions()
{
//if we're on testnet, just use two transactions per merge
if(Params().NetworkID() == CChainParams::TESTNET) return 2;
if(Params().NetworkID() == CChainParams::TESTNET || Params().NetworkID() == CChainParams::REGTEST) return 2;
//use the production amount
return POOL_MAX_TRANSACTIONS;

View File

@ -17,7 +17,7 @@
using namespace std;
using namespace boost;
std::vector<CTransactionLock> vecTxLocks;
std::map<uint256, CTransaction> mapTxLockReq;
@ -53,7 +53,7 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
int nTxAge = GetInputAge(tx.vin[0]);
if(nTxAge < 5){
LogPrintf("ProcessMessageInstantX::txlreq - Transaction not found / too new: %s\n", tx.GetHash().ToString().c_str());
return;
return;
}
int nBlockHeight = chainActive.Tip()->nHeight - nTxAge; //calculate the height
@ -66,11 +66,11 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
bool fMissingInputs = false;
CValidationState state;
if (AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs))
{
RelayTransactionLockReq(tx, inv.hash);
DoConsensusVote(tx, true, nBlockHeight);
DoConsensusVote(tx, true, nBlockHeight);
mapTxLockReq.insert(make_pair(inv.hash, tx));
@ -87,7 +87,7 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
// can we get the conflicting transaction as proof?
RelayTransactionLockReq(tx, inv.hash);
DoConsensusVote(tx, false, nBlockHeight);
DoConsensusVote(tx, false, nBlockHeight);
LogPrintf("ProcessMessageInstantX::txlreq - Transaction Lock Request: %s %s : rejected %s\n",
pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str(),
@ -98,14 +98,14 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
return;
}
}
}
else if (strCommand == "txlvote") //InstantX Lock Consensus Votes
{
CConsensusVote ctx;
vRecv >> ctx;
ProcessConsensusVote(ctx);
return;
}
else if (strCommand == "txlock") //InstantX Lock Transaction Inputs
@ -146,7 +146,7 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
//we should have the lock request in place
if(!mapTxLockReq.count(inv.hash)){
//if we don't
//if we don't
bool fMissingInputs = false;
CValidationState state;
@ -190,7 +190,7 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
pnode->PushMessage("txlock", ctxl);
}
pwalletMain->UpdatedTransaction(ctxl.GetHash());
LogPrintf("InstantX :: Got Transaction Lock: %s %s : accepted %s\n",
@ -212,7 +212,7 @@ void DoConsensusVote(CTransaction& tx, bool approved, int64_t nBlockHeight)
int winner = GetCurrentMasterNode(1, nBlockHeight);
int n = GetMasternodeRank(activeMasternode.vin, nBlockHeight, MIN_INSTANTX_PROTO_VERSION);
if(n == -1 || winner == -1)
if(n == -1 || winner == -1)
{
LogPrintf("InstantX::DoConsensusVote - Unknown Masternode\n");
return;
@ -231,7 +231,7 @@ void DoConsensusVote(CTransaction& tx, bool approved, int64_t nBlockHeight)
ctx.vinMasternode = activeMasternode.vin;
ctx.approved = approved;
ctx.txHash = tx.GetHash();
ctx.nBlockHeight = nBlockHeight;
ctx.nBlockHeight = nBlockHeight;
if(!ctx.Sign()){
LogPrintf("InstantX::DoConsensusVote - Failed to sign consensus vote\n");
return;
@ -241,15 +241,15 @@ void DoConsensusVote(CTransaction& tx, bool approved, int64_t nBlockHeight)
return;
}
if(n == 1){ //I'm the winner
ProcessConsensusVote(ctx);
} else if(n <= 10){ // not winner, but in the top10
if(ConnectNode((CAddress)darkSendMasterNodes[winner].addr, NULL, true)){
if(ConnectNode((CAddress)vecMasternodes[winner].addr, NULL, true)){
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
if(darkSendMasterNodes[winner].addr != pnode->addr) continue;
if(vecMasternodes[winner].addr != pnode->addr) continue;
pnode->PushMessage("txlvote", ctx);
LogPrintf("InstantX::DoConsensusVote --- connected, sending vote %s\n", pnode->addr.ToString().c_str());
@ -269,7 +269,7 @@ void ProcessConsensusVote(CConsensusVote& ctx)
LogPrintf("InstantX::ProcessConsensusVote - Not masternode\n");
return;
}
int winner = GetCurrentMasterNode(1, ctx.nBlockHeight);
if(winner == -1) {
LogPrintf("InstantX::ProcessConsensusVote - Can't detect winning masternode\n");
@ -277,20 +277,20 @@ void ProcessConsensusVote(CConsensusVote& ctx)
}
//We're not the winning masternode
if(darkSendMasterNodes[winner].vin != activeMasternode.vin) {
if(vecMasternodes[winner].vin != activeMasternode.vin) {
LogPrintf("InstantX::ProcessConsensusVote - I'm not the winning masternode\n");
return;
}
int n = GetMasternodeRank(ctx.vinMasternode, ctx.nBlockHeight, MIN_INSTANTX_PROTO_VERSION);
if(n == -1)
if(n == -1)
{
LogPrintf("InstantX::ProcessConsensusVote - Unknown Masternode\n");
return;
}
if(n > 10)
if(n > 10)
{
LogPrintf("InstantX::ProcessConsensusVote - Masternode not in the top 10\n");
return;
@ -330,7 +330,7 @@ void CleanTransactionLocksList()
if(chainActive.Tip() == NULL) return;
std::map<uint256, CTransactionLock>::iterator it = mapTxLocks.begin();
while(it != mapTxLocks.end()) {
if(chainActive.Tip()->nHeight - it->second.nBlockHeight > 3){ //keep them for an hour
LogPrintf("Removing old transaction lock %s\n", it->second.GetHash().ToString().c_str());
@ -347,27 +347,27 @@ bool CConsensusVote::SignatureValid()
std::string errorMessage;
std::string strMessage = txHash.ToString().c_str() + boost::lexical_cast<std::string>(nBlockHeight) + boost::lexical_cast<std::string>(approved);
LogPrintf("verify strMessage %s \n", strMessage.c_str());
int n = GetMasternodeByVin(vinMasternode);
if(n == -1)
if(n == -1)
{
LogPrintf("InstantX::CConsensusVote::SignatureValid() - Unknown Masternode\n");
return false;
}
LogPrintf("verify addr %s \n", darkSendMasterNodes[0].addr.ToString().c_str());
LogPrintf("verify addr %s \n", darkSendMasterNodes[1].addr.ToString().c_str());
LogPrintf("verify addr %d %s \n", n, darkSendMasterNodes[n].addr.ToString().c_str());
LogPrintf("verify addr %s \n", vecMasternodes[0].addr.ToString().c_str());
LogPrintf("verify addr %s \n", vecMasternodes[1].addr.ToString().c_str());
LogPrintf("verify addr %d %s \n", n, vecMasternodes[n].addr.ToString().c_str());
CScript pubkey;
pubkey.SetDestination(darkSendMasterNodes[n].pubkey2.GetID());
pubkey.SetDestination(vecMasternodes[n].pubkey2.GetID());
CTxDestination address1;
ExtractDestination(pubkey, address1);
CBitcoinAddress address2(address1);
LogPrintf("verify pubkey2 %s \n", address2.ToString().c_str());
if(!darkSendSigner.VerifyMessage(darkSendMasterNodes[n].pubkey2, vchMasterNodeSignature, strMessage, errorMessage)) {
if(!darkSendSigner.VerifyMessage(vecMasternodes[n].pubkey2, vchMasterNodeSignature, strMessage, errorMessage)) {
LogPrintf("InstantX::CConsensusVote::SignatureValid() - Verify message failed\n");
return false;
}
@ -419,13 +419,13 @@ bool CTransactionLock::SignaturesValid()
{
int n = GetMasternodeRank(vote.vinMasternode, vote.nBlockHeight, MIN_INSTANTX_PROTO_VERSION);
if(n == -1)
if(n == -1)
{
LogPrintf("InstantX::DoConsensusVote - Unknown Masternode\n");
return false;
}
if(n > 10)
if(n > 10)
{
LogPrintf("InstantX::DoConsensusVote - Masternode not in the top 10\n");
return false;

View File

@ -7,7 +7,7 @@
#include <boost/lexical_cast.hpp>
/** The list of active masternodes */
std::vector<CMasterNode> darkSendMasterNodes;
std::vector<CMasterNode> vecMasternodes;
/** Object for who's going to get paid on which blocks */
CMasternodePayments masternodePayments;
// keep track of masternode votes I've seen
@ -26,7 +26,7 @@ void ProcessMasternodeConnections(){
BOOST_FOREACH(CNode* pnode, vNodes)
{
//if it's our masternode, let it be
if(darkSendPool.submittedToMasternode == pnode->addr) continue;
if((CNetAddr)darkSendPool.submittedToMasternode == (CNetAddr)pnode->addr) continue;
if(pnode->fDarkSendMaster){
LogPrintf("Closing masternode connection %s \n", pnode->addr.ToString().c_str());
@ -98,11 +98,14 @@ void ProcessMessageMasternode(CNode* pfrom, std::string& strCommand, CDataStream
return;
}
if((Params().NetworkID() == CChainParams::TESTNET && addr.GetPort() != 19999) || (!(Params().NetworkID() == CChainParams::TESTNET) && addr.GetPort() != 9999)) return;
if(
(Params().NetworkID() == CChainParams::TESTNET && addr.GetPort() != 19999) ||
(Params().NetworkID() == CChainParams::REGTEST && addr.GetPort() != 19999) ||
(Params().NetworkID() == CChainParams::MAIN && addr.GetPort() != 9999)) return;
//search existing masternode list, this is where we update existing masternodes with new dsee broadcasts
BOOST_FOREACH(CMasterNode& mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode& mn, vecMasternodes) {
if(mn.vin.prevout == vin.prevout) {
// count == -1 when it's a new entry
// e.g. We don't want the entry relayed/time updated when we're syncing the list
@ -129,12 +132,12 @@ void ProcessMessageMasternode(CNode* pfrom, std::string& strCommand, CDataStream
// make sure the vout that was signed is related to the transaction that spawned the masternode
// - this is expensive, so it's only done once per masternode
/* if(!darkSendSigner.IsVinAssociatedWithPubkey(vin, pubkey)) {
if(!darkSendSigner.IsVinAssociatedWithPubkey(vin, pubkey)) {
LogPrintf("dsee - Got mismatched pubkey and vin\n");
Misbehaving(pfrom->GetId(), 100);
return;
}
*/
if(fDebug) LogPrintf("dsee - Got NEW masternode entry %s\n", addr.ToString().c_str());
// make sure it's still unspent
@ -160,7 +163,7 @@ void ProcessMessageMasternode(CNode* pfrom, std::string& strCommand, CDataStream
// add our masternode
CMasterNode mn(addr, vin, pubkey, vchSig, sigTime, pubkey2, protocolVersion);
mn.UpdateLastSeen(lastUpdated);
darkSendMasterNodes.push_back(mn);
vecMasternodes.push_back(mn);
// if it matches our masternodeprivkey, then we've been remotely activated
if(pubkey2 == activeMasternode.pubKeyMasternode && protocolVersion == PROTOCOL_VERSION){
@ -208,7 +211,7 @@ void ProcessMessageMasternode(CNode* pfrom, std::string& strCommand, CDataStream
// see if we have this masternode
BOOST_FOREACH(CMasterNode& mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode& mn, vecMasternodes) {
if(mn.vin.prevout == vin.prevout) {
// LogPrintf("dseep - Found corresponding mn for vin: %s\n", vin.ToString().c_str());
// take this only if it's newer
@ -279,10 +282,10 @@ void ProcessMessageMasternode(CNode* pfrom, std::string& strCommand, CDataStream
}
} //else, asking for a specific node which is ok
int count = darkSendMasterNodes.size()-1;
int count = vecMasternodes.size()-1;
int i = 0;
BOOST_FOREACH(CMasterNode mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode mn, vecMasternodes) {
if(mn.addr.IsRFC1918()) continue; //local network
@ -402,7 +405,7 @@ int CountMasternodesAboveProtocol(int protocolVersion)
{
int i = 0;
BOOST_FOREACH(CMasterNode& mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode& mn, vecMasternodes) {
if(mn.protocolVersion < protocolVersion) continue;
i++;
}
@ -416,7 +419,7 @@ int GetMasternodeByVin(CTxIn& vin)
{
int i = 0;
BOOST_FOREACH(CMasterNode& mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode& mn, vecMasternodes) {
if (mn.vin == vin) return i;
i++;
}
@ -431,7 +434,7 @@ int GetCurrentMasterNode(int mod, int64_t nBlockHeight, int minProtocol)
int winner = -1;
// scan for winner
BOOST_FOREACH(CMasterNode mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode mn, vecMasternodes) {
mn.Check();
if(mn.protocolVersion < minProtocol) continue;
if(!mn.IsEnabled()) {
@ -462,7 +465,7 @@ int GetMasternodeByRank(int findRank, int64_t nBlockHeight, int minProtocol)
std::vector<pair<unsigned int, int> > vecMasternodeScores;
i = 0;
BOOST_FOREACH(CMasterNode mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode mn, vecMasternodes) {
mn.Check();
if(mn.protocolVersion < minProtocol) continue;
if(!mn.IsEnabled()) {
@ -493,7 +496,7 @@ int GetMasternodeRank(CTxIn& vin, int64_t nBlockHeight, int minProtocol)
{
std::vector<pair<unsigned int, CTxIn> > vecMasternodeScores;
BOOST_FOREACH(CMasterNode mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode mn, vecMasternodes) {
mn.Check();
if(mn.protocolVersion < minProtocol) continue;
if(!mn.IsEnabled()) {
@ -608,15 +611,15 @@ void CMasterNode::Check()
bool CMasternodePayments::CheckSignature(CMasternodePaymentWinner& winner)
{
//note: need to investigate why this is failing
/* std::string strMessage = winner.vin.ToString().c_str() + boost::lexical_cast<std::string>(winner.nBlockHeight);
std::string strPubKey = (Params().NetworkID() == CChainParams::TESTNET) ? strTestPubKey : strMainPubKey;
std::string strMessage = winner.vin.ToString().c_str() + boost::lexical_cast<std::string>(winner.nBlockHeight);
std::string strPubKey = (Params().NetworkID() == CChainParams::MAIN) ? strMainPubKey : strTestPubKey;
CPubKey pubkey(ParseHex(strPubKey));
std::string errorMessage = "";
if(!darkSendSigner.VerifyMessage(pubkey, winner.vchSig, strMessage, errorMessage)){
return false;
}
*/
return true;
}
@ -763,14 +766,14 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
uint256 blockHash = 0;
if(!darkSendPool.GetBlockHash(blockHash, nBlockHeight-576)) return false;
BOOST_FOREACH(CMasterNode& mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode& mn, vecMasternodes) {
mn.Check();
if(!mn.IsEnabled()) {
continue;
}
if(LastPayment(mn) < darkSendMasterNodes.size()*.9) continue;
if(LastPayment(mn) < vecMasternodes.size()*.9) continue;
uint64_t score = CalculateScore(blockHash, mn.vin);
if(score > winner.score){

View File

@ -24,7 +24,7 @@ class CMasternodePayments;
#define MASTERNODE_NOT_CAPABLE 2
#define MASTERNODE_STOPPED 3
#define MASTERNODE_INPUT_TOO_NEW 4
#define MASTERNODE_PORT_NOT_OPEN 6
#define MASTERNODE_PORT_NOT_OPEN 6
#define MASTERNODE_PORT_OPEN 7
#define MASTERNODE_SYNC_IN_PROCESS 8
#define MASTERNODE_REMOTELY_ENABLED 9
@ -38,7 +38,7 @@ class CMasternodePayments;
using namespace std;
extern std::vector<CMasterNode> darkSendMasterNodes;
extern std::vector<CMasterNode> vecMasternodes;
extern CMasternodePayments masternodePayments;
extern std::vector<CTxIn> vecMasternodeAskedFor;
extern map<uint256, int> mapSeenMasternodeVotes;
@ -57,10 +57,10 @@ int GetMasternodeByRank(int findRank, int64_t nBlockHeight=0, int minProtocol=0)
void ProcessMessageMasternode(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
//
//
// The Masternode Class. For managing the darksend process. It contains the input of the 1000DRK, signature to prove
// it's the one who own that ip address and code for calculating the payment election.
//
//
class CMasterNode
{
public:
@ -92,7 +92,7 @@ public:
now = newNow;
enabled = 1;
lastTimeSeen = 0;
unitTest = false;
unitTest = false;
cacheInputAge = 0;
cacheInputAgeBlock = 0;
nLastDsq = 0;
@ -124,7 +124,7 @@ public:
bool UpdatedWithin(int seconds)
{
// LogPrintf("UpdatedWithin %d, %d -- %d \n", GetAdjustedTime() , lastTimeSeen, (GetAdjustedTime() - lastTimeSeen) < seconds);
return (GetAdjustedTime() - lastTimeSeen) < seconds;
}
@ -183,7 +183,7 @@ public:
};
//
// Masternode Payments Class
// Masternode Payments Class
// Keeps track of who should get paid for which blocks
//
@ -206,11 +206,11 @@ public:
bool SetPrivKey(std::string strPrivKey);
bool CheckSignature(CMasternodePaymentWinner& winner);
bool Sign(CMasternodePaymentWinner& winner);
// Deterministically calculate a given "score" for a masternode depending on how close it's hash is
// to the blockHeight. The further away they are the better, the furthest will win the election
// Deterministically calculate a given "score" for a masternode depending on how close it's hash is
// to the blockHeight. The further away they are the better, the furthest will win the election
// and get paid this block
//
//
uint64_t CalculateScore(uint256 blockHash, CTxIn& vin);
bool GetWinningMasternode(int nBlockHeight, CTxIn& vinOut);
@ -226,7 +226,7 @@ public:
};
/*//
// Masternode Scanning Error
// Masternode Scanning Error
// Enforces proof-of-service by scanning the masternode network
//
@ -249,11 +249,11 @@ public:
bool SetPrivKey(std::string strPrivKey);
bool CheckSignature(CMasternodePaymentWinner& winner);
bool Sign(CMasternodePaymentWinner& winner);
// Deterministically calculate a given "score" for a masternode depending on how close it's hash is
// to the blockHeight. The further away they are the better, the furthest will win the election
// Deterministically calculate a given "score" for a masternode depending on how close it's hash is
// to the blockHeight. The further away they are the better, the furthest will win the election
// and get paid this block
//
//
uint64_t CalculateScore(uint256 blockHash, CTxIn& vin);
bool GetWinningMasternode(int nBlockHeight, CTxIn& vinOut);

View File

@ -170,7 +170,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
//no masternode detected
int winningNode = GetCurrentMasterNode(1);
if(winningNode >= 0){
pblock->payee.SetDestination(darkSendMasterNodes[winningNode].pubkey.GetID());
pblock->payee.SetDestination(vecMasternodes[winningNode].pubkey.GetID());
} else {
LogPrintf("CreateNewBlock: Failed to detect masternode to pay\n");
hasPayment = false;

View File

@ -435,7 +435,8 @@ CNode* FindNode(const CService& addr)
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
if ((CService)pnode->addr == addr)
//if ((CService)pnode->addr == addr)
if((CNetAddr)pnode->addr == (CNetAddr)addr)
return (pnode);
return NULL;
}
@ -1885,7 +1886,7 @@ void RelayDarkSendIn(const std::vector<CTxIn>& in, const int64_t& nAmount, const
BOOST_FOREACH(CNode* pnode, vNodes)
{
if(darkSendPool.submittedToMasternode != pnode->addr) continue;
if((CNetAddr)darkSendPool.submittedToMasternode != (CNetAddr)pnode->addr) continue;
LogPrintf("RelayDarkSendIn - found master, relaying message - %s \n", pnode->addr.ToString().c_str());
pnode->PushMessage("dsi", in, nAmount, txCollateral, out);
}

View File

@ -110,6 +110,7 @@ class CService : public CNetAddr
unsigned short GetPort() const;
bool GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const;
bool SetSockAddr(const struct sockaddr* paddr);
friend bool operator==(const CService& a, const CService& b);
friend bool operator!=(const CService& a, const CService& b);
friend bool operator<(const CService& a, const CService& b);

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>573</width>
<height>342</height>
<height>557</height>
</rect>
</property>
<property name="windowTitle">
@ -90,152 +90,152 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>12</number>
</property>
<property name="verticalSpacing">
<number>12</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Available:</string>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
</widget>
<property name="horizontalSpacing">
<number>12</number>
</property>
<property name="verticalSpacing">
<number>12</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Available:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelBalance">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>Your current spendable balance</string>
</property>
<property name="text">
<string notr="true">0 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Pending:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labelUnconfirmed">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>Total of transactions that have yet to be confirmed, and do not yet count toward the spendable balance</string>
</property>
<property name="text">
<string notr="true">0 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelImmatureText">
<property name="text">
<string>Immature:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="labelImmature">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="toolTip">
<string>Mined balance that has not yet matured</string>
</property>
<property name="text">
<string notr="true">0 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelTotalText">
<property name="text">
<string>Total:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="labelTotal">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>Your current total balance</string>
</property>
<property name="text">
<string notr="true">0 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelBalance">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>Your current spendable balance</string>
</property>
<property name="text">
<string notr="true">0 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Pending:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labelUnconfirmed">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>Total of transactions that have yet to be confirmed, and do not yet count toward the spendable balance</string>
</property>
<property name="text">
<string notr="true">0 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelImmatureText">
<property name="text">
<string>Immature:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="labelImmature">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="toolTip">
<string>Mined balance that has not yet matured</string>
</property>
<property name="text">
<string notr="true">0 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelTotalText">
<property name="text">
<string>Total:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="labelTotal">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>Your current total balance</string>
</property>
<property name="text">
<string notr="true">0 BTC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
@ -366,9 +366,9 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_10">
<widget class="QLabel" name="labelSubmittedDenom">
<property name="text">
<string></string>
<string>n/a</string>
</property>
</widget>
</item>

View File

@ -23,10 +23,17 @@
<attribute name="title">
<string>&amp;Information</string>
</attribute>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0">
<property name="horizontalSpacing">
<number>12</number>
</property>
<item row="9" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Masternode Count</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="font">
@ -40,137 +47,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Client name</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="clientName">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Client version</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="clientVersion">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Using OpenSSL version</string>
</property>
<property name="indent">
<number>10</number>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="openSSLVersion">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Build date</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="buildDate">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Startup time</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="startupTime">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_11">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Network</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
@ -178,6 +54,13 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Client name</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="networkName">
<property name="cursor">
@ -201,6 +84,189 @@
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QPushButton" name="openDebugLogfileButton">
<property name="toolTip">
<string>Open the Darkcoin debug log file from the current data directory. This can take a few seconds for large log files.</string>
</property>
<property name="text">
<string>&amp;Open</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="16" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Startup time</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_11">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Network</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLabel" name="numberOfBlocks">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Last block time</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="labelDebugLogfile">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Debug log file</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Using OpenSSL version</string>
</property>
<property name="indent">
<number>10</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Build date</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="openSSLVersion">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Current number of blocks</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="clientName">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="clientVersion">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QLabel" name="lastBlockTime">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="13" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="1">
<widget class="QLabel" name="numberOfConnections">
<property name="cursor">
@ -217,7 +283,46 @@
</property>
</widget>
</item>
<item row="9" column="0">
<item row="4" column="1">
<widget class="QLabel" name="buildDate">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Client version</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="startupTime">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_10">
<property name="font">
<font>
@ -230,104 +335,13 @@
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Current number of blocks</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLabel" name="numberOfBlocks">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<item row="9" column="1">
<widget class="QLabel" name="masternodeCount">
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Last block time</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLabel" name="lastBlockTime">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="12" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="13" column="0">
<widget class="QLabel" name="labelDebugLogfile">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Debug log file</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QPushButton" name="openDebugLogfileButton">
<property name="toolTip">
<string>Open the Darkcoin debug log file from the current data directory. This can take a few seconds for large log files.</string>
</property>
<property name="text">
<string>&amp;Open</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="15" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_console">

View File

@ -411,12 +411,12 @@ void OverviewPage::darkSendStatus()
if(darkSendPool.sessionDenom == 0){
ui->label_10->setText("n/a");
ui->labelSubmittedDenom->setText("n/a");
} else {
std::string out;
darkSendPool.GetDenominationsToString(darkSendPool.sessionDenom, out);
QString s2(out.c_str());
ui->label_10->setText(s2);
ui->labelSubmittedDenom->setText(s2);
}
showingDarkSendMessage++;

View File

@ -11,6 +11,7 @@
#include "rpcserver.h"
#include "rpcclient.h"
#include "masternode.h"
#include "json/json_spirit_value.h"
#include <openssl/crypto.h>
@ -372,6 +373,11 @@ void RPCConsole::setNumBlocks(int count)
ui->numberOfBlocks->setText(QString::number(count));
if(clientModel)
ui->lastBlockTime->setText(clientModel->getLastBlockDate().toString());
// set masternode count
QString masternodes = QString::number((int)vecMasternodes.size());
ui->masternodeCount->setText(masternodes);
}
void RPCConsole::on_lineEdit_returnPressed()

View File

@ -251,7 +251,7 @@ Value masternode(const Array& params, bool fHelp)
}
Object obj;
BOOST_FOREACH(CMasterNode mn, darkSendMasterNodes) {
BOOST_FOREACH(CMasterNode mn, vecMasternodes) {
mn.Check();
if(strCommand == "active"){
@ -278,7 +278,7 @@ Value masternode(const Array& params, bool fHelp)
}
return obj;
}
if (strCommand == "count") return (int)darkSendMasterNodes.size();
if (strCommand == "count") return (int)vecMasternodes.size();
if (strCommand == "start")
{
@ -455,7 +455,7 @@ Value masternode(const Array& params, bool fHelp)
{
int winner = GetCurrentMasterNode(1);
if(winner >= 0) {
return darkSendMasterNodes[winner].addr.ToString().c_str();
return vecMasternodes[winner].addr.ToString().c_str();
}
return "unknown";