Skip to content

Commit

Permalink
Merge pull request #193 from carsenk/v3.4
Browse files Browse the repository at this point in the history
v3.3.6
  • Loading branch information
metaspartan authored Feb 5, 2019
2 parents e079933 + 0ec5132 commit 2d50cf7
Show file tree
Hide file tree
Showing 42 changed files with 1,921 additions and 318 deletions.
4 changes: 3 additions & 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.3.0
VERSION = 3.3.6.0
INCLUDEPATH += src src/json src/qt src/tor src/qt/plugins/mrichtexteditor
DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE
CONFIG += no_include_pwd
Expand Down Expand Up @@ -221,6 +221,7 @@ HEADERS += src/qt/bitcoingui.h \
src/qt/intro.h \
src/qt/transactiontablemodel.h \
src/qt/addresstablemodel.h \
src/qt/peertablemodel.h \
src/qt/optionsdialog.h \
src/qt/coincontroldialog.h \
src/qt/coincontroltreewidget.h \
Expand Down Expand Up @@ -342,6 +343,7 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \
src/qt/intro.cpp \
src/qt/transactiontablemodel.cpp \
src/qt/addresstablemodel.cpp \
src/qt/peertablemodel.cpp \
src/qt/optionsdialog.cpp \
src/qt/sendcoinsdialog.cpp \
src/qt/coincontroldialog.cpp \
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// 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 3
#define CLIENT_VERSION_REVISION 6
#define CLIENT_VERSION_BUILD 0

// Converts the parameter X to a string after macro replacement on X has been performed.
Expand Down
15 changes: 3 additions & 12 deletions src/fortuna.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ std::vector<CTxIn> vecFortunastakesUsed;
map<uint256, CFortunaBroadcastTx> mapFortunaBroadcastTxes;
//
CActiveFortunastake activeFortunastake;

// count peers we've requested the list from
int RequestedFortunaStakeList = 0;

Expand Down Expand Up @@ -1018,11 +1017,8 @@ void ThreadCheckForTunaPool(void* parg)
//let's connect to a random fortunastake every minute!
int fs = rand() % vecFortunastakes.size();
CService addr = vecFortunastakes[fs].addr;
if(ConnectNode((CAddress)addr, NULL, true)){
if (fDebug) printf("successfully connected to fortunastake at %s\n",addr.ToStringIPPort().c_str());
} else {
printf("error connecting to fortunastake at %s\n",addr.ToStringIPPort().c_str());
}
AddOneShot(addr.ToStringIPPort());
if (fDebug) printf("added fortunastake at %s to connection attempts\n",addr.ToStringIPPort().c_str());


//if we're low on peers, let's connect to some random ipv4 fortunastakes. ipv6 probably won't route anyway
Expand All @@ -1032,13 +1028,8 @@ void ThreadCheckForTunaPool(void* parg)
int fs = rand() % vecFortunastakes.size();
CService addr = vecFortunastakes[fs].addr;
if (addr.IsIPv4() && !addr.IsLocal()) {
if(ConnectNode((CAddress)addr, NULL, true)){
if (fDebug) printf("successfully connected to fortunastake at %s\n",addr.ToStringIPPort().c_str());
} else {
printf("error connecting to fortunastake at %s\n",addr.ToStringIPPort().c_str());
}
AddOneShot(addr.ToStringIPPort());
}
//MilliSleep(250); // 250 msecs * 50 nodes = 42.5sec, just in time to run this again if needed!
}

}
Expand Down
396 changes: 360 additions & 36 deletions src/fortunastake.cpp

Large diffs are not rendered by default.

79 changes: 72 additions & 7 deletions src/fortunastake.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,67 @@ int CountFortunastakesAboveProtocol(int protocolVersion);
void ProcessMessageFortunastake(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
bool CheckFortunastakeVin(CTxIn& vin, std::string& errorMessage, CBlockIndex *pindex);

// For storing payData
class CFortunaPayData
{
public:
int height;
uint256 hash;
int64_t amount;

CFortunaPayData() {
height = 0;
hash = 0;
amount = 0;
}

};

class CFortunaCollateral
{
public:
CTxIn vin;
CScript scriptPubKey;
int height;
uint256 blockHash;

CFortunaCollateral() {
height = 0;
blockHash = 0;
}
};

// For storing payData
class CFortunaPayments
{
public:
std::vector<CFortunaStake> vStakes; // this array should be sorted
std::vector<CFortunaPayData> vPayments; // this array just contains our scanned data
//std::vector<CTxIn> vCollaterals;
std::vector<CFortunaCollateral> vCollaterals;
std::vector<CScript> vScripts;

CFortunaPayments() {
// fill vStakes array with pointers to MN's from vecFortunastakes
}

bool add(CFortunaStake* mn)
{
// add address of pointer into the payments array
return true;
}

bool remove(CFortunaStake* mn)
{
// remove address of pointer from the payments array
return true;
}

void update(const CBlockIndex *pindex, bool force = false);

bool initialize(const CBlockIndex* pindex);
};

//
// The Fortunastake Class. For managing the fortuna process. It contains the input of the 5000 D, signature to prove
// it's the one who own that ip address and code for calculating the payment election.
Expand All @@ -79,7 +140,7 @@ class CFortunaStake
CPubKey pubkey;
CPubKey pubkey2;
std::vector<unsigned char> sig;
std::vector<pair<int, int64_t> > payData;
std::vector<CFortunaPayData> payData;
pair<int, int64_t> payInfo;
int64_t payRate;
int payCount;
Expand All @@ -96,7 +157,6 @@ class CFortunaStake
int64_t lastTimeChecked;
int nBlockLastPaid;
int64_t nTimeLastChecked;
int64_t nTimeLastPaid;
int64_t nTimeRegistered;
int nRank;

Expand All @@ -123,9 +183,11 @@ class CFortunaStake
lastTimeChecked = 0;
nBlockLastPaid = 0;
nTimeLastChecked = 0;
nTimeLastPaid = 0;
nTimeRegistered = newNow;
nRank = 0;
payValue = 0;
payRate = 0;
payCount = 0;
}

uint256 CalculateScore(int mod=1, int64_t nBlockHeight=0);
Expand All @@ -146,10 +208,12 @@ class CFortunaStake
}
}

int IsActive(CBlockIndex* pindex) {
return ((lastDseep > (GetAdjustedTime() - FORTUNASTAKE_MIN_DSEEP_SECONDS)) &&
(lastTimeSeen - now > (max(FORTUNASTAKE_FAIR_PAYMENT_MINIMUM, (int)mnCount) * 30))
); // dsee broadcast is more than a round old & active from dseeps
bool IsActive() {
if (lastTimeSeen - now > (max(FORTUNASTAKE_FAIR_PAYMENT_MINIMUM, (int)mnCount) * 30))
{ // dsee broadcast is more than a round old, let's consider it active
return true;
}
return false;
}

inline uint64_t SliceHash(uint256& hash, int slice)
Expand Down Expand Up @@ -202,6 +266,7 @@ int GetFortunastakeRank(CFortunaStake& tmn, CBlockIndex* pindex, int minProtocol
int GetFortunastakeByRank(int findRank, int64_t nBlockHeight=0, int minProtocol=CFortunaStake::minProtoVersion);
bool GetFortunastakeRanks(CBlockIndex* pindex=pindexBest);
extern int64_t nAverageFSIncome;
bool FindFSPayment(CScript& payee, CBlockIndex* pindex=pindexBest);

// for storing the winning payments
class CFortunastakePaymentWinner
Expand Down
5 changes: 3 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ bool AppInit2()

nNodeLifespan = GetArg("-addrlifespan", 7);
fUseFastIndex = GetBoolArg("-fastindex", true);
nMinStakeInterval = GetArg("-minstakeinterval", 30);
nMinerSleep = GetArg("-minersleep", 30000); //500
nMinStakeInterval = GetArg("-minstakeinterval", 60); // 2 blocks, don't make pos chains!
nMinerSleep = GetArg("-minersleep", 10000); //default 10seconds, higher=more cpu usage

// Largest block you're willing to create.
// Limit to betweeen 1K and MAX_BLOCK_SIZE-1K for sanity:
Expand Down Expand Up @@ -586,6 +586,7 @@ bool AppInit2()
fDebugRingSig = GetBoolArg("-debugringsig");

fNoSmsg = GetBoolArg("-nosmsg");
fDisableStealth = GetBoolArg("-disablestealth"); // force-disable stealth transaction scanning

bitdb.SetDetach(GetBoolArg("-detachdb", false));

Expand Down
Loading

0 comments on commit 2d50cf7

Please sign in to comment.