Few cleanups:

- compiling errors
- output
- CBitcoinAddress usage cleanup
- refresh qt project file
- fix typo in `masternode` debug category
This commit is contained in:
UdjinM6 2015-08-28 23:04:14 +03:00
parent 4fb859f3c8
commit 657bd1103e
11 changed files with 41 additions and 136 deletions

View File

@ -1,7 +1,9 @@
######################################################################
# Automatically generated by qmake (2.01a) ?? ??? 17 02:23:35 2015
# Automatically generated by qmake (2.01a) ?? ??? 23 17:50:54 2015
######################################################################
DEFINES += ENABLE_WALLET
TEMPLATE = app
TARGET =
DEPENDPATH += . \
@ -42,11 +44,11 @@ INCLUDEPATH += . \
src/obj \
src/univalue \
src/json \
src/qt \
src/qt/forms \
src/compat \
src/secp256k1/include \
src/leveldb/helpers/memenv \
src/qt \
src/qt/forms \
src/test/data \
src/test \
src/qt/test \
@ -76,6 +78,7 @@ HEADERS += src/activemasternode.h \
src/crypter.h \
src/darksend-relay.h \
src/darksend.h \
src/dash-config.h \
src/db.h \
src/eccryptoverify.h \
src/ecwrapper.h \
@ -88,7 +91,9 @@ HEADERS += src/activemasternode.h \
src/leveldbwrapper.h \
src/limitedmap.h \
src/main.h \
src/masternode-budget.h \
src/masternode-payments.h \
src/masternode-sync.h \
src/masternode.h \
src/masternodeconfig.h \
src/masternodeman.h \
@ -375,6 +380,7 @@ SOURCES += src/activemasternode.cpp \
src/db.cpp \
src/eccryptoverify.cpp \
src/ecwrapper.cpp \
src/editaddressdialog.cpp \
src/hash.cpp \
src/init.cpp \
src/instantx.cpp \
@ -383,7 +389,9 @@ SOURCES += src/activemasternode.cpp \
src/keystore.cpp \
src/leveldbwrapper.cpp \
src/main.cpp \
src/masternode-budget.cpp \
src/masternode-payments.cpp \
src/masternode-sync.cpp \
src/masternode.cpp \
src/masternodeconfig.cpp \
src/masternodeman.cpp \
@ -399,9 +407,9 @@ SOURCES += src/activemasternode.cpp \
src/rest.cpp \
src/rpcblockchain.cpp \
src/rpcclient.cpp \
src/rpcmasternode.cpp \
src/rpcmasternode-budget.cpp \
src/rpcdump.cpp \
src/rpcmasternode-budget.cpp \
src/rpcmasternode.cpp \
src/rpcmining.cpp \
src/rpcmisc.cpp \
src/rpcnet.cpp \
@ -634,31 +642,17 @@ SOURCES += src/activemasternode.cpp \
src/leveldb/helpers/memenv/memenv_test.cc \
src/secp256k1/src/java/org_bitcoin_NativeSecp256k1.c
RESOURCES += src/qt/dash.qrc src/qt/dash_locale.qrc
TRANSLATIONS += src/qt/locale/dash_bar.ts \
src/qt/locale/dash_bg.ts \
src/qt/locale/dash_ca.ts \
src/qt/locale/dash_cmn.ts \
src/qt/locale/dash_cs.ts \
src/qt/locale/dash_da.ts \
TRANSLATIONS += src/qt/locale/dash_bg.ts \
src/qt/locale/dash_de.ts \
src/qt/locale/dash_el.ts \
src/qt/locale/dash_en.ts \
src/qt/locale/dash_eo.ts \
src/qt/locale/dash_es.ts \
src/qt/locale/dash_fi.ts \
src/qt/locale/dash_fr.ts \
src/qt/locale/dash_hu_HU.ts \
src/qt/locale/dash_it.ts \
src/qt/locale/dash_lv_LV.ts \
src/qt/locale/dash_nb.ts \
src/qt/locale/dash_nl.ts \
src/qt/locale/dash_pl.ts \
src/qt/locale/dash_pt.ts \
src/qt/locale/dash_pt_BR.ts \
src/qt/locale/dash_ru.ts \
src/qt/locale/dash_sk.ts \
src/qt/locale/dash_sv.ts \
src/qt/locale/dash_tr.ts \
src/qt/locale/dash_vi.ts \
src/qt/locale/dash_zh_CN.ts \
src/qt/locale/dash_zh_HK.ts
src/qt/locale/dash_zh_TW.ts

View File

@ -1237,7 +1237,7 @@ bool CDarksendPool::SignFinalTransaction(CTransaction& finalTransactionNew, CNod
if(fMasterNode) return false;
finalTransaction = finalTransactionNew;
LogPrintf("CDarksendPool::SignFinalTransaction %s\n", finalTransaction.ToString());
LogPrintf("CDarksendPool::SignFinalTransaction %s", finalTransaction.ToString());
vector<CTxIn> sigs;

View File

@ -1475,7 +1475,7 @@ bool AppInit2(boost::thread_group& threadGroup)
if((fMasterNode || masternodeConfig.getCount() > -1) && fTxIndex == false) {
return InitError("Enabling Masternode support requires turning on transaction indexing."
"Please add txindex=1 to your configuration and start with --reindex=1");
"Please add txindex=1 to your configuration and start with -reindex");
}
if(fMasterNode) {

View File

@ -439,21 +439,6 @@ void CleanTransactionLocksList()
if(GetTime() > it->second.nExpiration){ //keep them for an hour
LogPrintf("Removing old transaction lock %s\n", it->second.txHash.ToString().c_str());
// loop through masternodes that responded
for(int nRank = 0; nRank <= INSTANTX_SIGNATURES_TOTAL; nRank++)
{
CMasternode* pmn = mnodeman.GetMasternodeByRank(nRank, it->second.nBlockHeight, MIN_INSTANTX_PROTO_VERSION);
if(!pmn) continue;
bool fFound = false;
BOOST_FOREACH(CConsensusVote& v, it->second.vecConsensusVotes)
{
if(pmn->vin == v.vinMasternode){ //Masternode responded
fFound = true;
}
}
}
if(mapTxLockReq.count(it->second.txHash)){
CTransaction& tx = mapTxLockReq[it->second.txHash];
@ -495,17 +480,6 @@ bool CConsensusVote::SignatureValid()
return false;
}
//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 = GetScriptForDestination(pmn->pubkey2.GetID());
CTxDestination address1;
ExtractDestination(pubkey, address1);
CBitcoinAddress address2(address1);
//LogPrintf("verify pubkey2 %s \n", address2.ToString().c_str());
if(!darkSendSigner.VerifyMessage(pmn->pubkey2, vchMasterNodeSignature, strMessage, errorMessage)) {
LogPrintf("InstantX::CConsensusVote::SignatureValid() - Verify message failed\n");
return false;
@ -530,13 +504,6 @@ bool CConsensusVote::Sign()
return false;
}
CScript pubkey;
pubkey = GetScriptForDestination(pubkey2.GetID());
CTxDestination address1;
ExtractDestination(pubkey, address1);
CBitcoinAddress address2(address1);
//LogPrintf("signing pubkey2 %s \n", address2.ToString().c_str());
if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchMasterNodeSignature, key2)) {
LogPrintf("CConsensusVote::Sign() - Sign message failed");
return false;

View File

@ -785,7 +785,7 @@ void CBudgetManager::NewBlock()
// incremental sync with our peers
if(masternodeSync.IsSynced()){
LogPrintf("CBudgetManager::NewBlock - incremental sync started");
LogPrintf("CBudgetManager::NewBlock - incremental sync started\n");
if(chainActive.Height() % 600 == rand() % 600) {
ClearSeen();
ResetSync();
@ -1505,41 +1505,6 @@ int CBudgetProposal::GetRemainingPaymentCount()
return (nPayments <= nTotal ? nPayments : nTotal);
}
CBudgetProposalBroadcast::CBudgetProposalBroadcast()
{
strProposalName = "unknown";
strURL = "";
nBlockStart = 0;
nBlockEnd = 0;
nAmount = 0;
nFeeTXHash = 0;
nTime = 0;
}
CBudgetProposalBroadcast::CBudgetProposalBroadcast(const CBudgetProposal& other)
{
strProposalName = other.strProposalName;
strURL = other.strURL;
nBlockStart = other.nBlockStart;
nBlockEnd = other.nBlockEnd;
address = other.address;
nAmount = other.nAmount;
nFeeTXHash = other.nFeeTXHash;
nTime = other.nTime;
}
CBudgetProposalBroadcast::CBudgetProposalBroadcast(const CBudgetProposalBroadcast& other)
{
strProposalName = other.strProposalName;
strURL = other.strURL;
nBlockStart = other.nBlockStart;
nBlockEnd = other.nBlockEnd;
address = other.address;
nAmount = other.nAmount;
nFeeTXHash = other.nFeeTXHash;
nTime = other.nTime;
}
CBudgetProposalBroadcast::CBudgetProposalBroadcast(std::string strProposalNameIn, std::string strURLIn, int nPaymentCount, CScript addressIn, CAmount nAmountIn, int nBlockStartIn, uint256 nFeeTXHashIn)
{
strProposalName = strProposalNameIn;

View File

@ -488,13 +488,10 @@ public:
// Proposals are cast then sent to peers with this object, which leaves the votes out
class CBudgetProposalBroadcast : public CBudgetProposal
{
private:
std::vector<unsigned char> vchSig;
public:
CBudgetProposalBroadcast();
CBudgetProposalBroadcast(const CBudgetProposal& other);
CBudgetProposalBroadcast(const CBudgetProposalBroadcast& other);
CBudgetProposalBroadcast() : CBudgetProposal(){}
CBudgetProposalBroadcast(const CBudgetProposal& other) : CBudgetProposal(other){}
CBudgetProposalBroadcast(const CBudgetProposalBroadcast& other) : CBudgetProposal(other){}
CBudgetProposalBroadcast(std::string strProposalNameIn, std::string strURLIn, int nPaymentCount, CScript addressIn, CAmount nAmountIn, int nBlockStartIn, uint256 nFeeTXHashIn);
void swap(CBudgetProposalBroadcast& first, CBudgetProposalBroadcast& second) // nothrow

View File

@ -455,7 +455,7 @@ bool CMasternodeBroadcast::CheckInputsAndAdd(int& nDoS)
}
}
LogPrint("masnernode", "mnb - Accepted Masternode entry\n");
LogPrint("masternode", "mnb - Accepted Masternode entry\n");
if(GetInputAge(vin) < MASTERNODE_MIN_CONFIRMATIONS){
LogPrintf("mnb - Input must have at least %d confirmations\n", MASTERNODE_MIN_CONFIRMATIONS);
@ -582,7 +582,7 @@ bool CMasternodePing::CheckAndUpdate(int& nDos, bool fRequireEnabled)
return false;
}
LogPrint("masnernode", "CMasternodePing::CheckAndUpdate - New Ping - %s - %s - %lli\n", GetHash().ToString(), blockHash.ToString(), sigTime);
LogPrint("masternode", "CMasternodePing::CheckAndUpdate - New Ping - %s - %s - %lli\n", GetHash().ToString(), blockHash.ToString(), sigTime);
// see if we have this Masternode
CMasternode* pmn = mnodeman.Find(vin);
@ -636,16 +636,16 @@ bool CMasternodePing::CheckAndUpdate(int& nDos, bool fRequireEnabled)
pmn->Check(true);
if(!pmn->IsEnabled()) return false;
LogPrint("masnernode", "CMasternodePing::CheckAndUpdate - Masternode ping accepted, vin: %s\n", vin.ToString());
LogPrint("masternode", "CMasternodePing::CheckAndUpdate - Masternode ping accepted, vin: %s\n", vin.ToString());
Relay();
return true;
}
LogPrint("masnernode", "CMasternodePing::CheckAndUpdate - Masternode ping arrived too early, vin: %s\n", vin.ToString());
LogPrint("masternode", "CMasternodePing::CheckAndUpdate - Masternode ping arrived too early, vin: %s\n", vin.ToString());
//nDos = 1; //disable, this is happening frequently and causing banned peers
return false;
}
LogPrint("masnernode", "CMasternodePing::CheckAndUpdate - Couldn't find compatible Masternode entry, vin: %s\n", vin.ToString());
LogPrint("masternode", "CMasternodePing::CheckAndUpdate - Couldn't find compatible Masternode entry, vin: %s\n", vin.ToString());
return false;
}

View File

@ -216,7 +216,7 @@ bool CMasternodeMan::Add(CMasternode &mn)
CMasternode *pmn = Find(mn.vin);
if (pmn == NULL)
{
LogPrint("masnernode", "CMasternodeMan: Adding new Masternode %s - %i now\n", mn.addr.ToString(), size() + 1);
LogPrint("masternode", "CMasternodeMan: Adding new Masternode %s - %i now\n", mn.addr.ToString(), size() + 1);
vMasternodes.push_back(mn);
return true;
}
@ -263,7 +263,7 @@ void CMasternodeMan::CheckAndRemove(bool forceExpiredRemoval)
(*it).activeState == CMasternode::MASTERNODE_VIN_SPENT ||
(forceExpiredRemoval && (*it).activeState == CMasternode::MASTERNODE_EXPIRED) ||
(*it).protocolVersion < masternodePayments.GetMinMasternodePaymentsProto()) {
LogPrint("masnernode", "CMasternodeMan: Removing inactive Masternode %s - %i now\n", (*it).addr.ToString(), size() - 1);
LogPrint("masternode", "CMasternodeMan: Removing inactive Masternode %s - %i now\n", (*it).addr.ToString(), size() - 1);
//erase all of the broadcasts we've seen from this vin
// -- if we missed a few pings and the node was removed, this will allow is to get it back without them
@ -472,7 +472,7 @@ CMasternode* CMasternodeMan::GetNextMasternodeInQueueForPayment(int nBlockHeight
//when the network is in the process of upgrading, don't penalize nodes that recently restarted
if(fFilterSigTime && nCount < nMnCount/3) return GetNextMasternodeInQueueForPayment(nBlockHeight, false, nCount);
// Sort them low to high
// Sort them high to low
sort(vecMasternodeLastPaid.rbegin(), vecMasternodeLastPaid.rend(), CompareLastPaid());
// Look at 1/10 of the oldest nodes (by last payment), calculate their scores and pay the best one
@ -724,7 +724,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
CMasternodePing mnp;
vRecv >> mnp;
LogPrint("masnernode", "mnp - Masternode ping, vin: %s\n", mnp.vin.ToString());
LogPrint("masternode", "mnp - Masternode ping, vin: %s\n", mnp.vin.ToString());
if(mapSeenMasternodePing.count(mnp.GetHash())) return; //seen
mapSeenMasternodePing.insert(make_pair(mnp.GetHash(), mnp));
@ -777,7 +777,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
if(mn.addr.IsRFC1918()) continue; //local network
if(mn.IsEnabled()) {
LogPrint("masnernode", "dseg - Sending Masternode entry - %s \n", mn.addr.ToString());
LogPrint("masternode", "dseg - Sending Masternode entry - %s \n", mn.addr.ToString());
if(vin == CTxIn() || vin == mn.vin){
CInv inv(MSG_MASTERNODE_ANNOUNCE, CMasternodeBroadcast(mn).GetHash());
vInv.push_back(inv);
@ -829,9 +829,6 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
return;
}
bool isLocal = addr.IsRFC1918() || addr.IsLocal();
if(Params().NetworkID() == CBaseChainParams::REGTEST) isLocal = false;
std::string vchPubKey(pubkey.begin(), pubkey.end());
std::string vchPubKey2(pubkey2.begin(), pubkey2.end());
@ -1096,7 +1093,7 @@ void CMasternodeMan::Remove(CTxIn vin)
vector<CMasternode>::iterator it = vMasternodes.begin();
while(it != vMasternodes.end()){
if((*it).vin == vin){
LogPrint("masnernode", "CMasternodeMan: Removing Masternode %s - %i now\n", (*it).addr.ToString(), size() - 1);
LogPrint("masternode", "CMasternodeMan: Removing Masternode %s - %i now\n", (*it).addr.ToString(), size() - 1);
vMasternodes.erase(it);
break;
}

View File

@ -131,7 +131,7 @@
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2_Main">
<layout class="QHBoxLayout" name="horizontalLayout_4_Main">
<item>
<widget class="QLabel" name="label">
<property name="toolTip">

View File

@ -208,16 +208,11 @@ Value masternode(const Array& params, bool fHelp)
CMasternode* winner = mnodeman.GetCurrentMasterNode(1);
if(winner) {
Object obj;
CScript pubkey;
pubkey = GetScriptForDestination(winner->pubkey.GetID());
CTxDestination address1;
ExtractDestination(pubkey, address1);
CBitcoinAddress address2(address1);
obj.push_back(Pair("IP:port", winner->addr.ToString()));
obj.push_back(Pair("protocol", (int64_t)winner->protocolVersion));
obj.push_back(Pair("vin", winner->vin.prevout.hash.ToString()));
obj.push_back(Pair("pubkey", address2.ToString()));
obj.push_back(Pair("pubkey", CBitcoinAddress(winner->pubkey.GetID()).ToString()));
obj.push_back(Pair("lastseen", (winner->lastPing == CMasternodePing()) ? winner->sigTime :
(int64_t)winner->lastPing.sigTime));
obj.push_back(Pair("activeseconds", (winner->lastPing == CMasternodePing()) ? 0 :
@ -561,12 +556,6 @@ Value masternodelist(const Array& params, bool fHelp)
strVin.find(strFilter) == string::npos) continue;
obj.push_back(Pair(strVin, mn.addr.ToString()));
} else if (strMode == "full") {
CScript pubkey;
pubkey = GetScriptForDestination(mn.pubkey.GetID());
CTxDestination address1;
ExtractDestination(pubkey, address1);
CBitcoinAddress address2(address1);
std::ostringstream addrStream;
addrStream << setw(21) << strVin;
@ -574,7 +563,7 @@ Value masternodelist(const Array& params, bool fHelp)
stringStream << setw(9) <<
mn.Status() << " " <<
mn.protocolVersion << " " <<
address2.ToString() << " " << setw(21) <<
CBitcoinAddress(mn.pubkey.GetID()).ToString() << " " << setw(21) <<
mn.addr.ToString() << " " <<
(int64_t)mn.lastPing.sigTime << " " << setw(8) <<
(int64_t)(mn.lastPing.sigTime - mn.sigTime) << " " <<
@ -596,15 +585,11 @@ Value masternodelist(const Array& params, bool fHelp)
strVin.find(strFilter) == string::npos) continue;
obj.push_back(Pair(strVin, (int64_t)mn.protocolVersion));
} else if (strMode == "pubkey") {
CScript pubkey;
pubkey = GetScriptForDestination(mn.pubkey.GetID());
CTxDestination address1;
ExtractDestination(pubkey, address1);
CBitcoinAddress address2(address1);
CBitcoinAddress address(mn.pubkey.GetID());
if(strFilter !="" && address2.ToString().find(strFilter) == string::npos &&
if(strFilter !="" && address.ToString().find(strFilter) == string::npos &&
strVin.find(strFilter) == string::npos) continue;
obj.push_back(Pair(strVin, address2.ToString()));
obj.push_back(Pair(strVin, address.ToString()));
} else if(strMode == "status") {
std::string strStatus = mn.Status();
if(strFilter !="" && strVin.find(strFilter) == string::npos && strStatus.find(strFilter) == string::npos) continue;

View File

@ -380,8 +380,8 @@ Value getblocktemplate(const Array& params, bool fHelp)
" { ... } (json object) vote candidate\n"
" ,...\n"
" ],\n"
" \"masternode_payments\" : true|false, (boolean) true, if masternode payments are enabled"
" \"enforce_masternode_payments\" : true|false (boolean) true, if masternode payments are enforced"
" \"masternode_payments\" : true|false, (boolean) true, if masternode payments are enabled\n"
" \"enforce_masternode_payments\" : true|false (boolean) true, if masternode payments are enforced\n"
"}\n"
"\nExamples:\n"