Skip to content

Commit

Permalink
(log) tweaks and (general) cleanup (#1086)
Browse files Browse the repository at this point in the history
* docs

* deprecated/unused/duplicate

* comments

* log cleanup/verbosity tuning

* names/ifs/whitespaces/std
  • Loading branch information
UdjinM6 authored Oct 22, 2016
1 parent 66c40e0 commit 2d55b70
Show file tree
Hide file tree
Showing 30 changed files with 281 additions and 339 deletions.
2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Use the autogen script to prepare the build environment.
make

Precompiled binaries are available at github, see
https://github.com/dashproject/dash-binaries
https://github.com/dashpay/dash-binaries

Always verify the signatures and checksums.

Expand Down
4 changes: 2 additions & 2 deletions dash-docs/protocol-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ Mixing pool status update
| 4 | nMsgSessionID | int | Session ID
| 4 | nMsgState | int | Current state of mixing process
| 4 | nMsgEntriesCount | int | Number of entries in the mixing pool
| 4 | nMsgAccepted | int | Was entries accepted or not
| 4 | nMsgErrorID | int | Error ID if any
| 4 | nMsgStatusUpdate | int | Update state and/or signal if entry was accepted or not
| 4 | nMsgMessageID | int | ID of the typical masternode reply message

### DSQUEUE - "dsq"

Expand Down
2 changes: 1 addition & 1 deletion doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Unpack the files into a directory, and then run dash-qt.exe.

### OS X

Drag Dash-Core to your applications folder, and then run Dash-Core.
Drag Dash-Qt to your applications folder, and then run Dash-Qt.

### Need Help?

Expand Down
2 changes: 1 addition & 1 deletion doc/build-osx.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Instructions: Homebrew

NOTE: Building with Qt4 is still supported, however, could result in a broken UI. As such, building with Qt5 is recommended.

### Building `Dash Core`
### Building Dash Core

1. Clone the GitHub tree to get the source code and go into the directory.

Expand Down
2 changes: 1 addition & 1 deletion doc/guide-startmany.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ You can confirm that remote server is on the correct block by issuing

```dash-cli getinfo```

and comparing with the official explorer at http://explorer.dash.org/chain/Dash
and comparing with the official explorer at https://explorer.dash.org/chain/Dash

### Local

Expand Down
2 changes: 1 addition & 1 deletion doc/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ Note: check that SHA256SUMS itself doesn't end up in SHA256SUMS, which is a spur

- Announce the release:

- Release sticky on dashtalk: https://dashtalk.org/index.php?board=1.0 ***TODO***
- Release on Dash forum: https://www.dash.org/forum/topic/official-announcements.54/

- Dash-development mailing list

Expand Down
14 changes: 7 additions & 7 deletions qa/pull-tester/rpc-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@
'timestampindex.py',
'spentindex.py',
'decodescript.py',
'p2p-fullblocktest.py', # TODO: works, needs dash_hash
'p2p-fullblocktest.py', # NOTE: needs dash_hash to pass
'blockchain.py',
'disablewallet.py',
'sendheaders.py', # TODO: works, needs dash_hash
'sendheaders.py', # NOTE: needs dash_hash to pass
'keypool.py',
'prioritise_transaction.py',
'invalidblockrequest.py', # TODO: works, needs dash_hash
'invalidtxrequest.py', # TODO: works, needs dash_hash
'invalidblockrequest.py', # NOTE: needs dash_hash to pass
'invalidtxrequest.py', # NOTE: needs dash_hash to pass
'abandonconflict.py',
'p2p-versionbits-warning.py',
]
Expand All @@ -132,9 +132,9 @@
testScriptsExt = [
'bip9-softforks.py',
'bip65-cltv.py',
'bip65-cltv-p2p.py', # TODO: works, needs dash_hash
'bip65-cltv-p2p.py', # NOTE: needs dash_hash to pass
'bip68-sequence.py',
'bipdersig-p2p.py', # TODO: works, needs dash_hash
'bipdersig-p2p.py', # NOTE: needs dash_hash to pass
'bipdersig.py',
'getblocktemplate_longpoll.py', # FIXME: "socket.error: [Errno 54] Connection reset by peer" on my Mac, same as https://github.com/bitcoin/bitcoin/issues/6651
'getblocktemplate_proposals.py',
Expand All @@ -146,7 +146,7 @@
# 'rpcbind_test.py', #temporary, bug in libevent, see #6655
'smartfees.py',
'maxblocksinflight.py',
'p2p-acceptblock.py', # TODO: works, needs dash_hash
'p2p-acceptblock.py', # NOTE: needs dash_hash to pass
'mempool_packages.py',
'maxuploadtarget.py',
# 'replace-by-fee.py', # RBF is disabled in Dash Core
Expand Down
29 changes: 6 additions & 23 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ void CActiveMasternode::ManageState()

if(eType == MASTERNODE_REMOTE) {
ManageStateRemote();
}
else {
} else {
ManageStateLocal();
}

Expand All @@ -55,12 +54,12 @@ void CActiveMasternode::ManageState()
std::string CActiveMasternode::GetStatus()
{
switch (nState) {
case ACTIVE_MASTERNODE_INITIAL: return "Node just started, not yet activated";
case ACTIVE_MASTERNODE_INITIAL: return "Node just started, not yet activated";
case ACTIVE_MASTERNODE_SYNC_IN_PROCESS: return "Sync in progress. Must wait until sync is complete to start Masternode";
case ACTIVE_MASTERNODE_INPUT_TOO_NEW: return strprintf("Masternode input must have at least %d confirmations", Params().GetConsensus().nMasternodeMinimumConfirmations);
case ACTIVE_MASTERNODE_NOT_CAPABLE: return "Not capable masternode: " + strNotCapableReason;
case ACTIVE_MASTERNODE_STARTED: return "Masternode successfully started";
default: return "unknown";
case ACTIVE_MASTERNODE_INPUT_TOO_NEW: return strprintf("Masternode input must have at least %d confirmations", Params().GetConsensus().nMasternodeMinimumConfirmations);
case ACTIVE_MASTERNODE_NOT_CAPABLE: return "Not capable masternode: " + strNotCapableReason;
case ACTIVE_MASTERNODE_STARTED: return "Masternode successfully started";
default: return "unknown";
}
}

Expand Down Expand Up @@ -117,22 +116,6 @@ bool CActiveMasternode::SendMasternodePing(std::string& strErrorRet)
return true;
}

// when starting a Masternode, this can enable to run as a hot wallet with no funds
bool CActiveMasternode::EnableRemoteMasterNode(CTxIn& vinNew, CService& serviceNew)
{
if(!fMasterNode) return false;

nState = ACTIVE_MASTERNODE_STARTED;

//The values below are needed for signing mnping messages going forward
vin = vinNew;
service = serviceNew;

LogPrintf("CActiveMasternode::EnableHotColdMasterNode -- Enabled! You may shut down the cold daemon.\n");

return true;
}

void CActiveMasternode::ManageStateInitial()
{
LogPrint("masternode", "CActiveMasternode::ManageStateInitial -- Start status = %s, type = %s, pinger enabled = %d\n", GetStatus(), GetType(), fPingerEnabled);
Expand Down
6 changes: 0 additions & 6 deletions src/activemasternode.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,11 @@ class CActiveMasternode
void ManageState();

std::string GetStatus();

std::string GetType();

/// Enable cold wallet mode (run a Masternode with no funds)
bool EnableRemoteMasterNode(CTxIn& vinNew, CService& serviceNew);

private:
void ManageStateInitial();

void ManageStateRemote();

void ManageStateLocal();
};

Expand Down
4 changes: 2 additions & 2 deletions src/base58.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ class CBase58Data
};

/** base58-encoded Dash addresses.
* Public-key-hash-addresses have version 0 (or 111 testnet).
* Public-key-hash-addresses have version 76 (or 140 testnet).
* The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key.
* Script-hash-addresses have version 5 (or 196 testnet).
* Script-hash-addresses have version 16 (or 19 testnet).
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
*/
class CBitcoinAddress : public CBase58Data {
Expand Down
29 changes: 16 additions & 13 deletions src/darksend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ bool CDarksendPool::AddEntry(const CDarkSendEntry& entryNew, PoolMessage& nMessa

bool CDarksendPool::AddScriptSig(const CTxIn& txinNew)
{
LogPrint("privatesend", "CDarksendPool::AddScriptSig -- new sig, scriptSig=%s\n", ScriptToAsmStr(txinNew.scriptSig).substr(0,24));
LogPrint("privatesend", "CDarksendPool::AddScriptSig -- scriptSig=%s\n", ScriptToAsmStr(txinNew.scriptSig).substr(0,24));

BOOST_FOREACH(const CDarkSendEntry& entry, vecEntries) {
BOOST_FOREACH(const CTxDSIn& txdsin, entry.vecTxDSIn) {
Expand All @@ -1031,7 +1031,7 @@ bool CDarksendPool::AddScriptSig(const CTxIn& txinNew)
return false;
}

LogPrint("privatesend", "CDarksendPool::AddScriptSig -- scriptSig=%s\n", ScriptToAsmStr(txinNew.scriptSig));
LogPrint("privatesend", "CDarksendPool::AddScriptSig -- scriptSig=%s new\n", ScriptToAsmStr(txinNew.scriptSig).substr(0,24));

BOOST_FOREACH(CTxIn& txin, finalMutableTransaction.vin) {
if(txinNew.prevout == txin.prevout && txin.nSequence == txinNew.nSequence) {
Expand Down Expand Up @@ -1194,7 +1194,7 @@ bool CDarksendPool::UpdatePoolStateOnClient(PoolState nStateNew, int nEntriesCou
// check it to make sure it's what we want, then sign it if we agree.
// If we refuse to sign, it's possible we'll be charged collateral
//
bool CDarksendPool::SignFinalTransaction(const CTransaction& finalTransactionNew, CNode* node)
bool CDarksendPool::SignFinalTransaction(const CTransaction& finalTransactionNew, CNode* pnode)
{
if(fMasterNode) return false;

Expand Down Expand Up @@ -1265,8 +1265,8 @@ bool CDarksendPool::SignFinalTransaction(const CTransaction& finalTransactionNew
}

// push all of our signatures to the Masternode
if(sigs.size() > 0 && node != NULL)
node->PushMessage(NetMsgType::DSSIGNFINALTX, sigs);
if(!sigs.empty() && pnode != NULL)
pnode->PushMessage(NetMsgType::DSSIGNFINALTX, sigs);

return true;
}
Expand Down Expand Up @@ -1568,13 +1568,13 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun)
std::vector<COutput> vCoinsTmp;
// Try to match their denominations if possible
if(!pwalletMain->SelectCoinsByDenominations(dsq.nDenom, nValueMin, nBalanceNeedsAnonymized, vecTxInTmp, vCoinsTmp, nValueIn, 0, nPrivateSendRounds)) {
LogPrintf("CDarksendPool::DoAutomaticDenominating -- Couldn't match denominations %d\n", dsq.nDenom);
LogPrintf("CDarksendPool::DoAutomaticDenominating -- Couldn't match denominations %d (%s)\n", dsq.nDenom, GetDenominationsToString(dsq.nDenom));
continue;
}

CMasternode* pmn = mnodeman.Find(dsq.vin);
if(pmn == NULL) {
LogPrintf("CDarksendPool::DoAutomaticDenominating -- dsq masternode is not in masternode list! vin=%s\n", dsq.vin.ToString());
LogPrintf("CDarksendPool::DoAutomaticDenominating -- dsq masternode is not in masternode list, masternode=%s\n", dsq.vin.prevout.ToStringShort());
continue;
}
vecMasternodesUsed.push_back(dsq.vin);
Expand All @@ -1588,12 +1588,13 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun)
nSessionDenom = dsq.nDenom;

pnode->PushMessage(NetMsgType::DSACCEPT, nSessionDenom, txMyCollateral);
LogPrintf("CDarksendPool::DoAutomaticDenominating -- connected (from queue), sending dsa: nSessionDenom: %d, addr=%s\n", nSessionDenom, pnode->addr.ToString());
LogPrintf("CDarksendPool::DoAutomaticDenominating -- connected (from queue), sending DSACCEPT: nSessionDenom: %d (%s), addr=%s\n",
nSessionDenom, GetDenominationsToString(nSessionDenom), pnode->addr.ToString());
strAutoDenomResult = _("Mixing in progress...");
dsq.nTime = 0; //remove node
return true;
} else {
LogPrintf("CDarksendPool::DoAutomaticDenominating -- error connecting\n");
LogPrintf("CDarksendPool::DoAutomaticDenominating -- can't connect, addr=%s\n", pmn->addr.ToString());
strAutoDenomResult = _("Error connecting to Masternode.");
dsq.nTime = 0; //remove node
pmn->nPoSeBanScore++;
Expand Down Expand Up @@ -1631,7 +1632,7 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun)
LogPrintf("CDarksendPool::DoAutomaticDenominating -- attempt %d connection to Masternode %s\n", nTries, pmn->addr.ToString());
CNode* pnode = ConnectNode((CAddress)pmn->addr, NULL, true);
if(pnode) {
LogPrintf("CDarksendPool::DoAutomaticDenominating -- connected %s\n", pmn->vin.ToString());
LogPrintf("CDarksendPool::DoAutomaticDenominating -- connected, addr=%s\n", pmn->addr.ToString());
pSubmittedToMasternode = pmn;

std::vector<CAmount> vecAmounts;
Expand All @@ -1642,11 +1643,12 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun)
}

pnode->PushMessage(NetMsgType::DSACCEPT, nSessionDenom, txMyCollateral);
LogPrintf("CDarksendPool::DoAutomaticDenominating -- connected, sending DSACCEPT, nSessionDenom: %d\n", nSessionDenom);
LogPrintf("CDarksendPool::DoAutomaticDenominating -- connected, sending DSACCEPT, nSessionDenom: %d (%s)\n",
nSessionDenom, GetDenominationsToString(nSessionDenom));
strAutoDenomResult = _("Mixing in progress...");
return true;
} else {
LogPrintf("CDarksendPool::DoAutomaticDenominating -- can't connect %s\n", pmn->vin.ToString());
LogPrintf("CDarksendPool::DoAutomaticDenominating -- can't connect, addr=%s\n", pmn->addr.ToString());
nTries++;
pmn->nPoSeBanScore++;
continue;
Expand Down Expand Up @@ -2041,7 +2043,8 @@ bool CDarksendPool::IsDenomCompatibleWithSession(int nDenom, CTransaction txColl
return false;
}

LogPrintf("CDarksendPool::IsDenomCompatibleWithSession -- nSessionDenom: %d nSessionUsers: %d\n", nSessionDenom, nSessionUsers);
LogPrintf("CDarksendPool::IsDenomCompatibleWithSession -- nSessionDenom: %d (%s) nSessionUsers: %d\n",
nSessionDenom, GetDenominationsToString(nSessionDenom), nSessionUsers);

if(!fUnitTest && !IsCollateralValid(txCollateral)) {
LogPrint("privatesend", "CDarksendPool::IsDenomCompatibleWithSession -- collateral not valid!\n");
Expand Down
2 changes: 1 addition & 1 deletion src/darksend.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ class CDarksendPool
void SetState(PoolState nStateNew);

/// As a client, check and sign the final transaction
bool SignFinalTransaction(const CTransaction& finalTransactionNew, CNode* node);
bool SignFinalTransaction(const CTransaction& finalTransactionNew, CNode* pnode);

/// Relay mixing Messages
void RelayFinalTransaction(const CTransaction& txFinal);
Expand Down
Loading

0 comments on commit 2d55b70

Please sign in to comment.