Skip to content

Commit

Permalink
Merge pull request #230 from carsenk/v3.4
Browse files Browse the repository at this point in the history
Denarius v3.3.9.1
  • Loading branch information
metaspartan authored Jun 13, 2019
2 parents 9c09a96 + 4f5f79b commit d6cca99
Show file tree
Hide file tree
Showing 39 changed files with 2,758 additions and 2,908 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ PortIndex*
dist
*.app
*.dmg
.idea

2 changes: 1 addition & 1 deletion denarius-qt.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = Denarius
VERSION = 3.3.8.5
VERSION = 3.3.9.1
INCLUDEPATH += src src/json src/qt src/qt/plugins/mrichtexteditor
DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE
CONFIG += no_include_pwd
Expand Down
4 changes: 2 additions & 2 deletions src/alert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ std::string CUnsignedAlert::ToString() const
return strprintf(
"CAlert(\n"
" nVersion = %d\n"
" nRelayUntil = %"PRId64"\n"
" nExpiration = %"PRId64"\n"
" nRelayUntil = %" PRId64"\n"
" nExpiration = %" PRId64"\n"
" nID = %d\n"
" nCancel = %d\n"
" setCancel = %s\n"
Expand Down
2 changes: 1 addition & 1 deletion src/bitcoinrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive)
"HTTP/1.1 %d %s\r\n"
"Date: %s\r\n"
"Connection: %s\r\n"
"Content-Length: %"PRIszu"\r\n"
"Content-Length: %" PRIszu"\r\n"
"Content-Type: application/json\r\n"
"Server: denarius-json-rpc/%s\r\n"
"\r\n"
Expand Down
4 changes: 2 additions & 2 deletions src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 3
#define CLIENT_VERSION_MINOR 3
#define CLIENT_VERSION_REVISION 8
#define CLIENT_VERSION_BUILD 5
#define CLIENT_VERSION_REVISION 9
#define CLIENT_VERSION_BUILD 1

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
Expand Down
8 changes: 2 additions & 6 deletions src/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,27 +327,24 @@ class CAnonOutputCount
nSpends = 0;
nOwned = 0;
nLeastDepth = 0;
nCompromised = 0;
}

CAnonOutputCount(int64_t nValue_, int nExists_, int nSpends_, int nOwned_, int nLeastDepth_, int nCompromised_)
CAnonOutputCount(int64_t nValue_, int nExists_, int nSpends_, int nOwned_, int nLeastDepth_)
{
nValue = nValue_;
nExists = nExists_;
nSpends = nSpends_;
nOwned = nOwned_;
nLeastDepth = nLeastDepth_;
nCompromised = nCompromised_;
}

void set(int64_t nValue_, int nExists_, int nSpends_, int nOwned_, int nLeastDepth_, int nCompromised_)
void set(int64_t nValue_, int nExists_, int nSpends_, int nOwned_, int nLeastDepth_)
{
nValue = nValue_;
nExists = nExists_;
nSpends = nSpends_;
nOwned = nOwned_;
nLeastDepth = nLeastDepth_;
nCompromised = nCompromised_;
}

void addCoin(int nCoinDepth, int64_t nCoinValue)
Expand Down Expand Up @@ -396,7 +393,6 @@ class CAnonOutputCount
int nSpends;
int nOwned; // todo
int nLeastDepth;
int nCompromised;

};

Expand Down
2 changes: 1 addition & 1 deletion src/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ void CDBEnv::Flush(bool fShutdown)
else
mi++;
}
printf("DBFlush(%s)%s ended %15"PRId64"ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart);
printf("DBFlush(%s)%s ended %15" PRId64"ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart);
if (fShutdown)
{
char** listp;
Expand Down
2 changes: 1 addition & 1 deletion src/fortuna.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ int CForTunaPool::GetDenominationsByAmount(int64_t nAmount, int nDenomTarget){

bool CForTunaSigner::IsVinAssociatedWithPubkey(CTxIn& vin, CPubKey& pubkey){
bool fIsInitialDownload = IsInitialBlockDownload();
if(fIsInitialDownload) return;
if(fIsInitialDownload) return nullptr; // Needs to return a value, so returns null pointer v3.3.9.1 - macOS

CScript payee2;
payee2= GetScriptForDestination(pubkey.GetID());
Expand Down
13 changes: 7 additions & 6 deletions src/fortunastake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,11 @@ void ProcessMessageFortunastake(CNode* pfrom, std::string& strCommand, CDataStre
// mn.pubkey = pubkey, IsVinAssociatedWithPubkey is validated once below,
// after that they just need to match
if(count == -1 && mn.pubkey == pubkey && !mn.UpdatedWithin(FORTUNASTAKE_MIN_DSEE_SECONDS)){
mn.UpdateLastSeen();

mn.UpdateLastSeen(); // update last seen without the sigTime since it's a new entry
if(mn.now < sigTime){ //take the newest entry
if (fDebugFS & fDebugNet) printf("dsee - Got updated entry for %s\n", addr.ToString().c_str());
mn.UpdateLastSeen(); // update with current time (i.e. the time we received this 'new' dsee
mn.pubkey2 = pubkey2;
mn.now = sigTime;
mn.sig = vchSig;
Expand Down Expand Up @@ -543,7 +544,7 @@ bool GetFortunastakeRanks(CBlockIndex* pindex)
if (vecFortunastakeScoresListHash.size() > 0 && vecFortunastakeScoresListHash == pindex->GetBlockHash()) {
// if ScoresList was calculated for the current pindex hash, then just use that list
// TODO: make a vector of these somehow
if (fDebug) printf(" STARTCOPY (%"PRId64"ms)", GetTimeMillis() - nStartTime);
if (fDebug) printf(" STARTCOPY (%" PRId64"ms)", GetTimeMillis() - nStartTime);
BOOST_FOREACH(CFortunaStake& mn, vecFortunastakeScoresList)
{
i++;
Expand All @@ -557,7 +558,7 @@ bool GetFortunastakeRanks(CBlockIndex* pindex)
FortunaReorgBlock = false; // reset reorg flag, we can check now it's updated

// now we build the list for sorting
if (fDebug) printf(" STARTLOOP (%"PRId64"ms)", GetTimeMillis() - nStartTime);
if (fDebug) printf(" STARTLOOP (%" PRId64"ms)", GetTimeMillis() - nStartTime);
BOOST_FOREACH(CFortunaStake& mn, vecFortunastakes) {

mn.Check();
Expand All @@ -583,7 +584,7 @@ bool GetFortunastakeRanks(CBlockIndex* pindex)
// TODO: Store the whole Scores vector in a caching hash map, maybe need hashPrev as well to make sure it re calculates any different chains with the same end block?
//vecFortunastakeScoresCache.insert(make_pair(pindex->GetBlockHash(), vecFortunastakeScoresList));

if (fDebug) printf(" SORT (%"PRId64"ms)", GetTimeMillis() - nStartTime);
if (fDebug) printf(" SORT (%" PRId64"ms)", GetTimeMillis() - nStartTime);
sort(vecFortunastakeScores.rbegin(), vecFortunastakeScores.rend(), CompareLastPay(pindex)); // sort requires current pindex for modulus as pindexBest is different between clients

i = 0;
Expand All @@ -594,7 +595,7 @@ bool GetFortunastakeRanks(CBlockIndex* pindex)
s.first = i;
s.second->nRank = i;
}
if (fDebug) printf(" DONE (%"PRId64"ms)\n", GetTimeMillis() - nStartTime);
if (fDebug) printf(" DONE (%" PRId64"ms)\n", GetTimeMillis() - nStartTime);
return true;
}

Expand Down
4 changes: 3 additions & 1 deletion src/fortunastake.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class uint256;
#define FORTUNASTAKE_FAIR_PAYMENT_MINIMUM 200
#define FORTUNASTAKE_FAIR_PAYMENT_ROUNDS 3

#define FORTUNASTAKE_ACTIVETIME_FIXHEIGHT 2200000 // Still WIP

using namespace std;

class CFortunastakePaymentWinner;
Expand Down Expand Up @@ -201,7 +203,7 @@ class CFortunaStake

void UpdateLastSeen(int64_t override=0)
{
if(override == 0){
if (override == 0) {
lastTimeSeen = GetAdjustedTime();
} else {
lastTimeSeen = override;
Expand Down
51 changes: 26 additions & 25 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ bool AppInit2()
printf("Shutdown requested. Exiting.\n");
return false;
};
printf(" block index %15"PRId64"ms\n", GetTimeMillis() - nStart);
printf(" block index %15" PRId64"ms\n", GetTimeMillis() - nStart);

if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree"))
{
Expand Down Expand Up @@ -1056,7 +1056,7 @@ bool AppInit2()
};

printf("%s", strErrors.str().c_str());
printf(" wallet %15"PRId64"ms\n", GetTimeMillis() - nStart);
printf(" wallet %15" PRId64"ms\n", GetTimeMillis() - nStart);

RegisterWallet(pwalletMain);

Expand All @@ -1078,7 +1078,7 @@ bool AppInit2()
printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight);
nStart = GetTimeMillis();
pwalletMain->ScanForWalletTransactions(pindexRescan, true);
printf(" rescan %15"PRId64"ms\n", GetTimeMillis() - nStart);
printf(" rescan %15" PRId64"ms\n", GetTimeMillis() - nStart);
};

// Add wallet transactions that aren't already in a block to mapTransactions
Expand Down Expand Up @@ -1123,7 +1123,7 @@ bool AppInit2()
printf("Invalid or missing peers.dat; recreating\n");
}

printf("Loaded %i addresses from peers.dat %"PRId64"ms\n",
printf("Loaded %i addresses from peers.dat %" PRId64"ms\n",
addrman.size(), GetTimeMillis() - nStart);


Expand Down Expand Up @@ -1174,26 +1174,27 @@ bool AppInit2()
}
}

if(GetBoolArg("-mnconflock", true) && pwalletMain || GetBoolArg("-fsconflock", true) && pwalletMain) {
LOCK(pwalletMain->cs_wallet);
printf("Locking Fortunastakes:\n");
uint256 mnTxHash;
int outputIndex;
BOOST_FOREACH(CFortunastakeConfig::CFortunastakeEntry mne, fortunastakeConfig.getEntries()) {
mnTxHash.SetHex(mne.getTxHash());
outputIndex = boost::lexical_cast<unsigned int>(mne.getOutputIndex());
COutPoint outpoint = COutPoint(mnTxHash, outputIndex);
// don't lock non-spendable outpoint (i.e. it's already spent or it's not from this wallet at all)
if(pwalletMain->IsMine(CTxIn(outpoint)) != ISMINE_SPENDABLE) {
printf(" %s %s - IS NOT SPENDABLE, was not locked\n", mne.getTxHash().c_str(), mne.getOutputIndex().c_str());
continue;
if (pwalletMain) {
if(GetBoolArg("-fsconflock", true) & GetBoolArg("-mnconflock", true)) {
LOCK(pwalletMain->cs_wallet);
printf("Locking Fortunastakes:\n");
uint256 mnTxHash;
int outputIndex;
BOOST_FOREACH(CFortunastakeConfig::CFortunastakeEntry mne, fortunastakeConfig.getEntries()) {
mnTxHash.SetHex(mne.getTxHash());
outputIndex = boost::lexical_cast<unsigned int>(mne.getOutputIndex());
COutPoint outpoint = COutPoint(mnTxHash, outputIndex);
// don't lock non-spendable outpoint (i.e. it's already spent or it's not from this wallet at all)
if(pwalletMain->IsMine(CTxIn(outpoint)) != ISMINE_SPENDABLE) {
printf(" %s %s - IS NOT SPENDABLE, was not locked\n", mne.getTxHash().c_str(), mne.getOutputIndex().c_str());
continue;
}
pwalletMain->LockCoin(outpoint);
printf(" %s %s - locked successfully\n", mne.getTxHash().c_str(), mne.getOutputIndex().c_str());
}
pwalletMain->LockCoin(outpoint);
printf(" %s %s - locked successfully\n", mne.getTxHash().c_str(), mne.getOutputIndex().c_str());
}
}


// Add any fortunastake.conf fortunastakes to the adrenaline nodes
BOOST_FOREACH(CFortunastakeConfig::CFortunastakeEntry mne, fortunastakeConfig.getEntries())
{
Expand Down Expand Up @@ -1235,16 +1236,16 @@ bool AppInit2()
pblockAddrIndex = pblockAddrIndex->pprev;
}

printf("Rebuilt address index of %i blocks in %"PRId64"ms\n",
printf("Rebuilt address index of %i blocks in %" PRId64"ms\n",
pblockAddrIndex->nHeight, GetTimeMillis() - nStart);
}

//// debug print
printf("mapBlockIndex.size() = %"PRIszu"\n", mapBlockIndex.size());
printf("mapBlockIndex.size() = %" PRIszu"\n", mapBlockIndex.size());
printf("nBestHeight = %d\n", nBestHeight);
printf("setKeyPool.size() = %"PRIszu"\n", pwalletMain->setKeyPool.size());
printf("mapWallet.size() = %"PRIszu"\n", pwalletMain->mapWallet.size());
printf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain->mapAddressBook.size());
printf("setKeyPool.size() = %" PRIszu"\n", pwalletMain->setKeyPool.size());
printf("mapWallet.size() = %" PRIszu"\n", pwalletMain->mapWallet.size());
printf("mapAddressBook.size() = %" PRIszu"\n", pwalletMain->mapAddressBook.size());

if(fNativeTor)
printf("Native Tor Onion Relay Node Enabled");
Expand Down
12 changes: 6 additions & 6 deletions src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64_t& nStakeMod
return error("ComputeNextStakeModifier: unable to get last modifier");
if (fDebug)
{
printf("ComputeNextStakeModifier: prev modifier=0x%016"PRIx64" time=%s\n", nStakeModifier, DateTimeStrFormat(nModifierTime).c_str());
printf("ComputeNextStakeModifier: prev modifier=0x%016" PRIx64" time=%s\n", nStakeModifier, DateTimeStrFormat(nModifierTime).c_str());
}
if (nModifierTime / nModifierInterval >= pindexPrev->GetBlockTime() / nModifierInterval)
return true;
Expand Down Expand Up @@ -205,7 +205,7 @@ bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64_t& nStakeMod
}
if (fDebug)
{
printf("ComputeNextStakeModifier: new modifier=0x%016"PRIx64" time=%s\n", nStakeModifierNew, DateTimeStrFormat(pindexPrev->GetBlockTime()).c_str());
printf("ComputeNextStakeModifier: new modifier=0x%016" PRIx64" time=%s\n", nStakeModifierNew, DateTimeStrFormat(pindexPrev->GetBlockTime()).c_str());
}

nStakeModifier = nStakeModifierNew;
Expand Down Expand Up @@ -301,12 +301,12 @@ bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned
hashProofOfStake = Hash(ss.begin(), ss.end());
if (fPrintProofOfStake)
{
printf("CheckStakeKernelHash() : using modifier 0x%016"PRIx64" at height=%d timestamp=%s for block from height=%d timestamp=%s\n",
printf("CheckStakeKernelHash() : using modifier 0x%016" PRIx64" at height=%d timestamp=%s for block from height=%d timestamp=%s\n",
nStakeModifier, nStakeModifierHeight,
DateTimeStrFormat(nStakeModifierTime).c_str(),
mapBlockIndex[hashBlockFrom]->nHeight,
DateTimeStrFormat(blockFrom.GetBlockTime()).c_str());
printf("CheckStakeKernelHash() : check modifier=0x%016"PRIx64" nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n",
printf("CheckStakeKernelHash() : check modifier=0x%016" PRIx64" nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n",
nStakeModifier,
nTimeBlockFrom, nTxPrevOffset, txPrev.nTime, prevout.n, nTimeTx,
hashProofOfStake.ToString().c_str());
Expand All @@ -317,12 +317,12 @@ bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned
return false;
if (fDebug && !fPrintProofOfStake)
{
printf("CheckStakeKernelHash() : using modifier 0x%016"PRIx64" at height=%d timestamp=%s for block from height=%d timestamp=%s\n",
printf("CheckStakeKernelHash() : using modifier 0x%016" PRIx64" at height=%d timestamp=%s for block from height=%d timestamp=%s\n",
nStakeModifier, nStakeModifierHeight,
DateTimeStrFormat(nStakeModifierTime).c_str(),
mapBlockIndex[hashBlockFrom]->nHeight,
DateTimeStrFormat(blockFrom.GetBlockTime()).c_str());
printf("CheckStakeKernelHash() : pass modifier=0x%016"PRIx64" nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n",
printf("CheckStakeKernelHash() : pass modifier=0x%016" PRIx64" nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n",
nStakeModifier,
nTimeBlockFrom, nTxPrevOffset, txPrev.nTime, prevout.n, nTimeTx,
hashProofOfStake.ToString().c_str());
Expand Down
Loading

0 comments on commit d6cca99

Please sign in to comment.