mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge branch 'master' of https://github.com/darkcoin/darkcoin
This commit is contained in:
commit
e633bc437b
@ -5,8 +5,7 @@ Please be consistent with the existing coding style.
|
|||||||
|
|
||||||
Block style:
|
Block style:
|
||||||
|
|
||||||
bool Function(char* psz, int n)
|
bool Function(char* psz, int n) {
|
||||||
{
|
|
||||||
// Comment summarising what this section of code does
|
// Comment summarising what this section of code does
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
@ -65,9 +64,11 @@ Threads
|
|||||||
|
|
||||||
- StartNode : Starts other threads.
|
- StartNode : Starts other threads.
|
||||||
|
|
||||||
|
- ThreadCheckDarkSendPool : Builds and update Masternode list, starts auto-denomination
|
||||||
|
|
||||||
- ThreadGetMyExternalIP : Determines outside-the-firewall IP address, sends addr message to connected peers when it determines it.
|
- ThreadGetMyExternalIP : Determines outside-the-firewall IP address, sends addr message to connected peers when it determines it.
|
||||||
|
|
||||||
- ThreadSocketHandler : Sends/Receives data from peers on port 8333.
|
- ThreadSocketHandler : Sends/Receives data from peers on port 9999.
|
||||||
|
|
||||||
- ThreadMessageHandler : Higher-level message handling (sending and receiving).
|
- ThreadMessageHandler : Higher-level message handling (sending and receiving).
|
||||||
|
|
||||||
@ -83,9 +84,9 @@ Threads
|
|||||||
|
|
||||||
- ThreadFlushWalletDB : Close the wallet.dat file if it hasn't been used in 500ms.
|
- ThreadFlushWalletDB : Close the wallet.dat file if it hasn't been used in 500ms.
|
||||||
|
|
||||||
- ThreadRPCServer : Remote procedure call handler, listens on port 8332 for connections and services them.
|
- ThreadRPCServer : Remote procedure call handler, listens on port 9998 for connections and services them.
|
||||||
|
|
||||||
- ThreadBitcoinMiner : Generates bitcoins
|
- DarkcoinMiner : Generates darkcoins
|
||||||
|
|
||||||
- ThreadMapPort : Universal plug-and-play startup/shutdown
|
- ThreadMapPort : Universal plug-and-play startup/shutdown
|
||||||
|
|
||||||
|
@ -296,10 +296,12 @@ bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secr
|
|||||||
if(!strTxHash.empty()) {
|
if(!strTxHash.empty()) {
|
||||||
// Let's find it
|
// Let's find it
|
||||||
uint256 txHash(strTxHash);
|
uint256 txHash(strTxHash);
|
||||||
int outputIndex = boost::lexical_cast<int>(outputIndex);
|
int outputIndex = 0;
|
||||||
|
outputIndex = boost::lexical_cast<int>(outputIndex);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
BOOST_FOREACH(COutput& out, possibleCoins) {
|
BOOST_FOREACH(COutput& out, possibleCoins) {
|
||||||
if(true) {
|
if(out.tx->GetHash() == txHash && out.i == outputIndex)
|
||||||
|
{
|
||||||
selectedOutput = &out;
|
selectedOutput = &out;
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
12
src/base58.h
12
src/base58.h
@ -272,10 +272,10 @@ class CBitcoinAddress : public CBase58Data
|
|||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PUBKEY_ADDRESS = 48+28, // DarkCoin addresses start with X
|
PUBKEY_ADDRESS = 76, // Darkcoin addresses start with 'X'
|
||||||
SCRIPT_ADDRESS = 5,
|
SCRIPT_ADDRESS = 16, // Darkcoin script addresses start with '7'
|
||||||
PUBKEY_ADDRESS_TEST = 111,
|
PUBKEY_ADDRESS_TEST = 139, // Testnet darkcoin addresses start with 'x' or 'y'
|
||||||
SCRIPT_ADDRESS_TEST = 196,
|
SCRIPT_ADDRESS_TEST = 19, // Testnet darkcoin script addresses start with '8' or '9'
|
||||||
};
|
};
|
||||||
|
|
||||||
bool Set(const CKeyID &id) {
|
bool Set(const CKeyID &id) {
|
||||||
@ -400,8 +400,8 @@ class CBitcoinSecret : public CBase58Data
|
|||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PRIVKEY_ADDRESS = CBitcoinAddress::PUBKEY_ADDRESS + 128,
|
PRIVKEY_ADDRESS = 204, // Darkcoin private keys start with '7' or 'X'
|
||||||
PRIVKEY_ADDRESS_TEST = CBitcoinAddress::PUBKEY_ADDRESS_TEST + 128,
|
PRIVKEY_ADDRESS_TEST = 239, // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetKey(const CKey& vchSecret)
|
void SetKey(const CKey& vchSecret)
|
||||||
|
@ -1180,6 +1180,7 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
|
|||||||
if (strMethod == "listtransactions" && n > 2) ConvertTo<boost::int64_t>(params[2]);
|
if (strMethod == "listtransactions" && n > 2) ConvertTo<boost::int64_t>(params[2]);
|
||||||
if (strMethod == "listaccounts" && n > 0) ConvertTo<boost::int64_t>(params[0]);
|
if (strMethod == "listaccounts" && n > 0) ConvertTo<boost::int64_t>(params[0]);
|
||||||
if (strMethod == "walletpassphrase" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
if (strMethod == "walletpassphrase" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
||||||
|
if (strMethod == "walletpassphrase" && n > 2) ConvertTo<bool>(params[2]);
|
||||||
if (strMethod == "getblocktemplate" && n > 0) ConvertTo<Object>(params[0]);
|
if (strMethod == "getblocktemplate" && n > 0) ConvertTo<Object>(params[0]);
|
||||||
if (strMethod == "listsinceblock" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
if (strMethod == "listsinceblock" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
||||||
if (strMethod == "sendmany" && n > 1) ConvertTo<Object>(params[1]);
|
if (strMethod == "sendmany" && n > 1) ConvertTo<Object>(params[1]);
|
||||||
|
114
src/main.cpp
114
src/main.cpp
@ -943,7 +943,7 @@ bool CTxMemPool::acceptable(CValidationState &state, CTransaction &tx, bool fChe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for conflicts with in-memory transactions
|
// Check for conflicts with in-memory transactions
|
||||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||||
{
|
{
|
||||||
@ -980,7 +980,7 @@ bool CTxMemPool::acceptable(CValidationState &state, CTransaction &tx, bool fChe
|
|||||||
// only helps filling in pfMissingInputs (to determine missing vs spent).
|
// only helps filling in pfMissingInputs (to determine missing vs spent).
|
||||||
BOOST_FOREACH(const CTxIn txin, tx.vin) {
|
BOOST_FOREACH(const CTxIn txin, tx.vin) {
|
||||||
if (!view.HaveCoins(txin.prevout.hash)) {
|
if (!view.HaveCoins(txin.prevout.hash)) {
|
||||||
if (pfMissingInputs)
|
if (pfMissingInputs)
|
||||||
*pfMissingInputs = true;
|
*pfMissingInputs = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1048,7 +1048,7 @@ bool CTransaction::AcceptToMemoryPool(CValidationState &state, bool fCheckInputs
|
|||||||
|
|
||||||
bool CTransaction::IsAcceptable(CValidationState &state, bool fCheckInputs, bool fLimitFree, bool* pfMissingInputs, bool fScriptChecks)
|
bool CTransaction::IsAcceptable(CValidationState &state, bool fCheckInputs, bool fLimitFree, bool* pfMissingInputs, bool fScriptChecks)
|
||||||
{
|
{
|
||||||
return mempool.acceptable(state, *this, fCheckInputs, fLimitFree, pfMissingInputs, fScriptChecks);
|
return mempool.acceptable(state, *this, fCheckInputs, fLimitFree, pfMissingInputs, fScriptChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTransaction::AcceptableInputs(CValidationState &state, bool fLimitFree)
|
bool CTransaction::AcceptableInputs(CValidationState &state, bool fLimitFree)
|
||||||
@ -1167,7 +1167,7 @@ int CMerkleTx::IsTransactionLocked() const
|
|||||||
for (unsigned int b = 0; b < vout.size(); b++) {
|
for (unsigned int b = 0; b < vout.size(); b++) {
|
||||||
for(it_ctxl it = mapTxLocks.begin(); it != mapTxLocks.end(); it++) {
|
for(it_ctxl it = mapTxLocks.begin(); it != mapTxLocks.end(); it++) {
|
||||||
for (unsigned int a = 0; a < it->second.tx.vout.size(); a++) {
|
for (unsigned int a = 0; a < it->second.tx.vout.size(); a++) {
|
||||||
if(vout[b] == it->second.tx.vout[a])
|
if(vout[b] == it->second.tx.vout[a])
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
if(found > 0) break;
|
if(found > 0) break;
|
||||||
@ -1387,7 +1387,7 @@ int64 static GetBlockValue(int nBits, int nHeight, int64 nFees)
|
|||||||
/* fixed bug caused diff to not be correctly calculated */
|
/* fixed bug caused diff to not be correctly calculated */
|
||||||
if(nHeight > 4500 || fTestNet) dDiff = ConvertBitsToDouble(nBits);
|
if(nHeight > 4500 || fTestNet) dDiff = ConvertBitsToDouble(nBits);
|
||||||
|
|
||||||
int64 nSubsidy = 0;
|
int64 nSubsidy = 0;
|
||||||
if(nHeight >= 5465) {
|
if(nHeight >= 5465) {
|
||||||
if((nHeight >= 17000 && dDiff > 75) || nHeight >= 24000) { // GPU/ASIC difficulty calc
|
if((nHeight >= 17000 && dDiff > 75) || nHeight >= 24000) { // GPU/ASIC difficulty calc
|
||||||
// 2222222/(((x+2600)/9)^2)
|
// 2222222/(((x+2600)/9)^2)
|
||||||
@ -1412,7 +1412,7 @@ int64 static GetBlockValue(int nBits, int nHeight, int64 nFees)
|
|||||||
for(int i = 46200; i <= nHeight; i += 210240) nSubsidy -= nSubsidy/14;
|
for(int i = 46200; i <= nHeight; i += 210240) nSubsidy -= nSubsidy/14;
|
||||||
} else {
|
} else {
|
||||||
// yearly decline of production by 7.1% per year, projected 21.3M coins max by year 2050.
|
// yearly decline of production by 7.1% per year, projected 21.3M coins max by year 2050.
|
||||||
for(int i = 210240; i <= nHeight; i += 210240) nSubsidy -= nSubsidy/14;
|
for(int i = 210240; i <= nHeight; i += 210240) nSubsidy -= nSubsidy/14;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nSubsidy + nFees;
|
return nSubsidy + nFees;
|
||||||
@ -1424,7 +1424,7 @@ int64 GetMasternodePayment(int nHeight, int64 blockValue)
|
|||||||
|
|
||||||
if(fTestNet) {
|
if(fTestNet) {
|
||||||
if(nHeight > 46000) ret += blockValue / 20; //25% - 2014-10-07
|
if(nHeight > 46000) ret += blockValue / 20; //25% - 2014-10-07
|
||||||
if(nHeight > 46000+((576*1)*1)) ret += blockValue / 20; //30% - 2014-10-08
|
if(nHeight > 46000+((576*1)*1)) ret += blockValue / 20; //30% - 2014-10-08
|
||||||
if(nHeight > 46000+((576*1)*2)) ret += blockValue / 20; //35% - 2014-10-09
|
if(nHeight > 46000+((576*1)*2)) ret += blockValue / 20; //35% - 2014-10-09
|
||||||
if(nHeight > 46000+((576*1)*3)) ret += blockValue / 20; //40% - 2014-10-10
|
if(nHeight > 46000+((576*1)*3)) ret += blockValue / 20; //40% - 2014-10-10
|
||||||
if(nHeight > 46000+((576*1)*4)) ret += blockValue / 20; //45% - 2014-10-11
|
if(nHeight > 46000+((576*1)*4)) ret += blockValue / 20; //45% - 2014-10-11
|
||||||
@ -1433,7 +1433,7 @@ int64 GetMasternodePayment(int nHeight, int64 blockValue)
|
|||||||
if(nHeight > 46000+((576*1)*7)) ret += blockValue / 20; //60% - 2014-10-14
|
if(nHeight > 46000+((576*1)*7)) ret += blockValue / 20; //60% - 2014-10-14
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nHeight > 158000) ret += blockValue / 20; //25.0% - 2014-10-23
|
if(nHeight > 158000) ret += blockValue / 20; //25.0% - 2014-10-23
|
||||||
if(nHeight > 158000+((576*30)*1)) ret += blockValue / 20; //30.0% - 2014-11-23
|
if(nHeight > 158000+((576*30)*1)) ret += blockValue / 20; //30.0% - 2014-11-23
|
||||||
if(nHeight > 158000+((576*30)*2)) ret += blockValue / 20; //35.0% - 2014-12-23
|
if(nHeight > 158000+((576*30)*2)) ret += blockValue / 20; //35.0% - 2014-12-23
|
||||||
if(nHeight > 158000+((576*30)*3)) ret += blockValue / 40; //37.5% - 2015-01-23
|
if(nHeight > 158000+((576*30)*3)) ret += blockValue / 40; //37.5% - 2015-01-23
|
||||||
@ -1562,17 +1562,17 @@ unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBloc
|
|||||||
double EventHorizonDeviation;
|
double EventHorizonDeviation;
|
||||||
double EventHorizonDeviationFast;
|
double EventHorizonDeviationFast;
|
||||||
double EventHorizonDeviationSlow;
|
double EventHorizonDeviationSlow;
|
||||||
|
|
||||||
if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64)BlockLastSolved->nHeight < PastBlocksMin) { return bnProofOfWorkLimit.GetCompact(); }
|
if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64)BlockLastSolved->nHeight < PastBlocksMin) { return bnProofOfWorkLimit.GetCompact(); }
|
||||||
|
|
||||||
for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
|
for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
|
||||||
if (PastBlocksMax > 0 && i > PastBlocksMax) { break; }
|
if (PastBlocksMax > 0 && i > PastBlocksMax) { break; }
|
||||||
PastBlocksMass++;
|
PastBlocksMass++;
|
||||||
|
|
||||||
if (i == 1) { PastDifficultyAverage.SetCompact(BlockReading->nBits); }
|
if (i == 1) { PastDifficultyAverage.SetCompact(BlockReading->nBits); }
|
||||||
else { PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev; }
|
else { PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev; }
|
||||||
PastDifficultyAveragePrev = PastDifficultyAverage;
|
PastDifficultyAveragePrev = PastDifficultyAverage;
|
||||||
|
|
||||||
PastRateActualSeconds = BlockLastSolved->GetBlockTime() - BlockReading->GetBlockTime();
|
PastRateActualSeconds = BlockLastSolved->GetBlockTime() - BlockReading->GetBlockTime();
|
||||||
PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass;
|
PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass;
|
||||||
PastRateAdjustmentRatio = double(1);
|
PastRateAdjustmentRatio = double(1);
|
||||||
@ -1583,14 +1583,14 @@ unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBloc
|
|||||||
EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(28.2)), -1.228));
|
EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(28.2)), -1.228));
|
||||||
EventHorizonDeviationFast = EventHorizonDeviation;
|
EventHorizonDeviationFast = EventHorizonDeviation;
|
||||||
EventHorizonDeviationSlow = 1 / EventHorizonDeviation;
|
EventHorizonDeviationSlow = 1 / EventHorizonDeviation;
|
||||||
|
|
||||||
if (PastBlocksMass >= PastBlocksMin) {
|
if (PastBlocksMass >= PastBlocksMin) {
|
||||||
if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { assert(BlockReading); break; }
|
if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { assert(BlockReading); break; }
|
||||||
}
|
}
|
||||||
if (BlockReading->pprev == NULL) { assert(BlockReading); break; }
|
if (BlockReading->pprev == NULL) { assert(BlockReading); break; }
|
||||||
BlockReading = BlockReading->pprev;
|
BlockReading = BlockReading->pprev;
|
||||||
}
|
}
|
||||||
|
|
||||||
CBigNum bnNew(PastDifficultyAverage);
|
CBigNum bnNew(PastDifficultyAverage);
|
||||||
if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
|
if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
|
||||||
bnNew *= PastRateActualSeconds;
|
bnNew *= PastRateActualSeconds;
|
||||||
@ -1598,9 +1598,9 @@ unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bnNew > bnProofOfWorkLimit) {
|
if (bnNew > bnProofOfWorkLimit) {
|
||||||
bnNew = bnProofOfWorkLimit;
|
bnNew = bnProofOfWorkLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bnNew.GetCompact();
|
return bnNew.GetCompact();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1618,10 +1618,10 @@ unsigned int static DarkGravityWave3(const CBlockIndex* pindexLast, const CBlock
|
|||||||
CBigNum PastDifficultyAverage;
|
CBigNum PastDifficultyAverage;
|
||||||
CBigNum PastDifficultyAveragePrev;
|
CBigNum PastDifficultyAveragePrev;
|
||||||
|
|
||||||
if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || BlockLastSolved->nHeight < PastBlocksMin) {
|
if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || BlockLastSolved->nHeight < PastBlocksMin) {
|
||||||
return bnProofOfWorkLimit.GetCompact();
|
return bnProofOfWorkLimit.GetCompact();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
|
for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
|
||||||
if (PastBlocksMax > 0 && i > PastBlocksMax) { break; }
|
if (PastBlocksMax > 0 && i > PastBlocksMax) { break; }
|
||||||
CountBlocks++;
|
CountBlocks++;
|
||||||
@ -1636,12 +1636,12 @@ unsigned int static DarkGravityWave3(const CBlockIndex* pindexLast, const CBlock
|
|||||||
int64 Diff = (LastBlockTime - BlockReading->GetBlockTime());
|
int64 Diff = (LastBlockTime - BlockReading->GetBlockTime());
|
||||||
nActualTimespan += Diff;
|
nActualTimespan += Diff;
|
||||||
}
|
}
|
||||||
LastBlockTime = BlockReading->GetBlockTime();
|
LastBlockTime = BlockReading->GetBlockTime();
|
||||||
|
|
||||||
if (BlockReading->pprev == NULL) { assert(BlockReading); break; }
|
if (BlockReading->pprev == NULL) { assert(BlockReading); break; }
|
||||||
BlockReading = BlockReading->pprev;
|
BlockReading = BlockReading->pprev;
|
||||||
}
|
}
|
||||||
|
|
||||||
CBigNum bnNew(PastDifficultyAverage);
|
CBigNum bnNew(PastDifficultyAverage);
|
||||||
|
|
||||||
int64 nTargetTimespan = CountBlocks*nTargetSpacing;
|
int64 nTargetTimespan = CountBlocks*nTargetSpacing;
|
||||||
@ -1658,7 +1658,7 @@ unsigned int static DarkGravityWave3(const CBlockIndex* pindexLast, const CBlock
|
|||||||
if (bnNew > bnProofOfWorkLimit){
|
if (bnNew > bnProofOfWorkLimit){
|
||||||
bnNew = bnProofOfWorkLimit;
|
bnNew = bnProofOfWorkLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bnNew.GetCompact();
|
return bnNew.GetCompact();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1670,14 +1670,14 @@ unsigned int static GetNextWorkRequired_V2(const CBlockIndex* pindexLast, const
|
|||||||
int64 PastSecondsMax = TimeDaySeconds * 7;
|
int64 PastSecondsMax = TimeDaySeconds * 7;
|
||||||
uint64 PastBlocksMin = PastSecondsMin / BlocksTargetSpacing;
|
uint64 PastBlocksMin = PastSecondsMin / BlocksTargetSpacing;
|
||||||
uint64 PastBlocksMax = PastSecondsMax / BlocksTargetSpacing;
|
uint64 PastBlocksMax = PastSecondsMax / BlocksTargetSpacing;
|
||||||
|
|
||||||
return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
|
return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
|
unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
|
||||||
{
|
{
|
||||||
int DiffMode = 1;
|
int DiffMode = 1;
|
||||||
|
|
||||||
if (fTestNet) {
|
if (fTestNet) {
|
||||||
if (pindexLast->nHeight+1 >= 256) DiffMode = 3;
|
if (pindexLast->nHeight+1 >= 256) DiffMode = 3;
|
||||||
}
|
}
|
||||||
@ -1821,7 +1821,7 @@ void CBlockHeader::UpdateTime(const CBlockIndex* pindexPrev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint256 CBlockHeader::GetHash() const
|
uint256 CBlockHeader::GetHash() const
|
||||||
{
|
{
|
||||||
return HashX11(BEGIN(nVersion), END(nNonce));
|
return HashX11(BEGIN(nVersion), END(nNonce));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2807,16 +2807,19 @@ bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerk
|
|||||||
if(pindexBest->GetBlockHash() == hashPrevBlock){
|
if(pindexBest->GetBlockHash() == hashPrevBlock){
|
||||||
int64 masternodePaymentAmount = GetMasternodePayment(pindexBest->nHeight+1, vtx[0].GetValueOut());
|
int64 masternodePaymentAmount = GetMasternodePayment(pindexBest->nHeight+1, vtx[0].GetValueOut());
|
||||||
bool fIsInitialDownload = IsInitialBlockDownload();
|
bool fIsInitialDownload = IsInitialBlockDownload();
|
||||||
|
|
||||||
// If we don't already have its previous block, skip masternode payment step
|
// If we don't already have its previous block, skip masternode payment step
|
||||||
if (!fIsInitialDownload && pindexBest != NULL)
|
if (!fIsInitialDownload && pindexBest != NULL)
|
||||||
{
|
{
|
||||||
bool foundPaymentAmount = false;
|
bool foundPaymentAmount = false;
|
||||||
bool foundPayee = false;
|
bool foundPayee = false;
|
||||||
|
bool foundPaymentAndPayee = false;
|
||||||
|
|
||||||
CScript payee;
|
CScript payee;
|
||||||
if(!masternodePayments.GetBlockPayee(pindexBest->nHeight+1, payee) || payee == CScript()){
|
if(!masternodePayments.GetBlockPayee(pindexBest->nHeight+1, payee) || payee == CScript()){
|
||||||
foundPayee = true; //doesn't require a specific payee
|
foundPayee = true; //doesn't require a specific payee
|
||||||
|
foundPaymentAmount = true;
|
||||||
|
foundPaymentAndPayee = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < vtx[0].vout.size(); i++) {
|
for (unsigned int i = 0; i < vtx[0].vout.size(); i++) {
|
||||||
@ -2824,15 +2827,28 @@ bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerk
|
|||||||
foundPaymentAmount = true;
|
foundPaymentAmount = true;
|
||||||
if(vtx[0].vout[i].scriptPubKey == payee )
|
if(vtx[0].vout[i].scriptPubKey == payee )
|
||||||
foundPayee = true;
|
foundPayee = true;
|
||||||
|
if(vtx[0].vout[i].nValue == masternodePaymentAmount && vtx[0].vout[i].scriptPubKey == payee)
|
||||||
|
foundPaymentAndPayee = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!foundPaymentAmount || !foundPayee) {
|
if (GetBlockTime() < 1419207339){
|
||||||
CTxDestination address1;
|
if(!foundPaymentAmount || !foundPayee) {
|
||||||
ExtractDestination(payee, address1);
|
CTxDestination address1;
|
||||||
CBitcoinAddress address2(address1);
|
ExtractDestination(payee, address1);
|
||||||
|
CBitcoinAddress address2(address1);
|
||||||
|
|
||||||
LogPrintf("CheckBlock() : Couldn't find masternode payment(%d|%"PRI64u") or payee(%d|%s) nHeight %d. \n", foundPaymentAmount, masternodePaymentAmount, foundPayee, address2.ToString().c_str(), pindexBest->nHeight+1);
|
LogPrintf("CheckBlock() : Couldn't find masternode payment(%d|%"PRI64u") or payee(%d|%s) nHeight %d. \n", foundPaymentAmount, masternodePaymentAmount, foundPayee, address2.ToString().c_str(), pindexBest->nHeight+1);
|
||||||
if(EnforceMasternodePayments) return state.DoS(100, error("CheckBlock() : Couldn't find masternode payment or payee"));
|
if(EnforceMasternodePayments) return state.DoS(100, error("CheckBlock() : Couldn't find masternode payment or payee"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(!foundPaymentAndPayee) {
|
||||||
|
CTxDestination address1;
|
||||||
|
ExtractDestination(payee, address1);
|
||||||
|
CBitcoinAddress address2(address1);
|
||||||
|
|
||||||
|
LogPrintf("CheckBlock() : Couldn't find masternode payment(%d|%"PRI64u") or payee(%d|%s) nHeight %d. \n", foundPaymentAmount, masternodePaymentAmount, foundPayee, address2.ToString().c_str(), pindexBest->nHeight+1);
|
||||||
|
if(EnforceMasternodePayments) return state.DoS(100, error("CheckBlock() : Couldn't find masternode payment or payee"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2905,7 +2921,7 @@ bool CBlock::AcceptBlock(CValidationState &state, CDiskBlockPos *dbp)
|
|||||||
double n1 = ConvertBitsToDouble(nBits);
|
double n1 = ConvertBitsToDouble(nBits);
|
||||||
double n2 = ConvertBitsToDouble(nBitsNext);
|
double n2 = ConvertBitsToDouble(nBitsNext);
|
||||||
|
|
||||||
if (abs(n1-n2) > n1*0.5)
|
if (abs(n1-n2) > n1*0.5)
|
||||||
return state.DoS(100, error("AcceptBlock() : incorrect proof of work (DGW pre-fork) - %f", abs(n1-n2)));
|
return state.DoS(100, error("AcceptBlock() : incorrect proof of work (DGW pre-fork) - %f", abs(n1-n2)));
|
||||||
} else {
|
} else {
|
||||||
if (nBits != GetNextWorkRequired(pindexPrev, this))
|
if (nBits != GetNextWorkRequired(pindexPrev, this))
|
||||||
@ -3506,7 +3522,7 @@ bool InitBlockIndex() {
|
|||||||
if (pindexGenesisBlock != NULL) {
|
if (pindexGenesisBlock != NULL) {
|
||||||
// Check whether the master checkpoint key has changed and reset the sync checkpoint if needed.
|
// Check whether the master checkpoint key has changed and reset the sync checkpoint if needed.
|
||||||
if (!CheckCheckpointPubKey())
|
if (!CheckCheckpointPubKey())
|
||||||
return error("LoadBlockIndex() : failed to reset checkpoint master pubkey");
|
return error("LoadBlockIndex() : failed to reset checkpoint master pubkey");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3524,7 +3540,7 @@ bool InitBlockIndex() {
|
|||||||
// CTxOut(nValue=50.00000000, scriptPubKey=040184710fa689ad5023690c80f3a4)
|
// CTxOut(nValue=50.00000000, scriptPubKey=040184710fa689ad5023690c80f3a4)
|
||||||
// vMerkleTree: 97ddfbbae6
|
// vMerkleTree: 97ddfbbae6
|
||||||
|
|
||||||
// Genesis block
|
// Genesis block
|
||||||
const char* pszTimestamp = "Wired 09/Jan/2014 The Grand Experiment Goes Live: Overstock.com Is Now Accepting Bitcoins";
|
const char* pszTimestamp = "Wired 09/Jan/2014 The Grand Experiment Goes Live: Overstock.com Is Now Accepting Bitcoins";
|
||||||
CTransaction txNew;
|
CTransaction txNew;
|
||||||
txNew.vin.resize(1);
|
txNew.vin.resize(1);
|
||||||
@ -3926,7 +3942,7 @@ void static ProcessGetData(CNode* pfrom)
|
|||||||
{
|
{
|
||||||
// Send stream from relay memory
|
// Send stream from relay memory
|
||||||
bool pushed = false;
|
bool pushed = false;
|
||||||
|
|
||||||
if(!mapDarksendBroadcastTxes.count(inv.hash))
|
if(!mapDarksendBroadcastTxes.count(inv.hash))
|
||||||
{
|
{
|
||||||
LOCK(cs_mapRelay);
|
LOCK(cs_mapRelay);
|
||||||
@ -3942,10 +3958,10 @@ void static ProcessGetData(CNode* pfrom)
|
|||||||
if(mapDarksendBroadcastTxes.count(inv.hash)){
|
if(mapDarksendBroadcastTxes.count(inv.hash)){
|
||||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
ss.reserve(1000);
|
ss.reserve(1000);
|
||||||
ss <<
|
ss <<
|
||||||
mapDarksendBroadcastTxes[inv.hash].tx <<
|
mapDarksendBroadcastTxes[inv.hash].tx <<
|
||||||
mapDarksendBroadcastTxes[inv.hash].vin <<
|
mapDarksendBroadcastTxes[inv.hash].vin <<
|
||||||
mapDarksendBroadcastTxes[inv.hash].vchSig <<
|
mapDarksendBroadcastTxes[inv.hash].vchSig <<
|
||||||
mapDarksendBroadcastTxes[inv.hash].sigTime;
|
mapDarksendBroadcastTxes[inv.hash].sigTime;
|
||||||
|
|
||||||
pfrom->PushMessage("dstx", ss);
|
pfrom->PushMessage("dstx", ss);
|
||||||
@ -4073,7 +4089,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
// Change version
|
// Change version
|
||||||
pfrom->PushMessage("verack");
|
pfrom->PushMessage("verack");
|
||||||
pfrom->ssSend.SetVersion(min(pfrom->nVersion, PROTOCOL_VERSION));
|
pfrom->ssSend.SetVersion(min(pfrom->nVersion, PROTOCOL_VERSION));
|
||||||
|
|
||||||
if (!pfrom->fInbound)
|
if (!pfrom->fInbound)
|
||||||
{
|
{
|
||||||
// Advertise our address
|
// Advertise our address
|
||||||
@ -4381,7 +4397,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string strMessage = tx.GetHash().ToString() + boost::lexical_cast<std::string>(sigTime);
|
std::string strMessage = tx.GetHash().ToString() + boost::lexical_cast<std::string>(sigTime);
|
||||||
|
|
||||||
std::string errorMessage = "";
|
std::string errorMessage = "";
|
||||||
if(!darkSendSigner.VerifyMessage(mn.pubkey2, vchSig, strMessage, errorMessage)){
|
if(!darkSendSigner.VerifyMessage(mn.pubkey2, vchSig, strMessage, errorMessage)){
|
||||||
@ -4662,7 +4678,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//probably one the extensions
|
//probably one the extensions
|
||||||
ProcessMessageDarksend(pfrom, strCommand, vRecv);
|
ProcessMessageDarksend(pfrom, strCommand, vRecv);
|
||||||
ProcessMessageMasternode(pfrom, strCommand, vRecv);
|
ProcessMessageMasternode(pfrom, strCommand, vRecv);
|
||||||
ProcessMessageInstantX(pfrom, strCommand, vRecv);
|
ProcessMessageInstantX(pfrom, strCommand, vRecv);
|
||||||
@ -5098,7 +5114,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
int payments = 1;
|
int payments = 1;
|
||||||
// Create coinbase tx
|
// Create coinbase tx
|
||||||
CTransaction txNew;
|
CTransaction txNew;
|
||||||
txNew.vin.resize(1);
|
txNew.vin.resize(1);
|
||||||
txNew.vin[0].prevout.SetNull();
|
txNew.vin[0].prevout.SetNull();
|
||||||
txNew.vout.resize(1);
|
txNew.vout.resize(1);
|
||||||
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
|
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
|
||||||
@ -5116,13 +5132,13 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
bMasterNodePayment = true;
|
bMasterNodePayment = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64 nFees = 0;
|
int64 nFees = 0;
|
||||||
{
|
{
|
||||||
LOCK2(cs_main, mempool.cs);
|
LOCK2(cs_main, mempool.cs);
|
||||||
CCoinsViewCache view(*pcoinsTip, true);
|
CCoinsViewCache view(*pcoinsTip, true);
|
||||||
CBlockIndex* pindexPrev = pindexBest;
|
CBlockIndex* pindexPrev = pindexBest;
|
||||||
|
|
||||||
if(bMasterNodePayment) {
|
if(bMasterNodePayment) {
|
||||||
bool hasPayment = true;
|
bool hasPayment = true;
|
||||||
//spork
|
//spork
|
||||||
@ -5131,7 +5147,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
int winningNode = GetCurrentMasterNode(1);
|
int winningNode = GetCurrentMasterNode(1);
|
||||||
if(winningNode >= 0){
|
if(winningNode >= 0){
|
||||||
pblock->payee.SetDestination(darkSendMasterNodes[winningNode].pubkey.GetID());
|
pblock->payee.SetDestination(darkSendMasterNodes[winningNode].pubkey.GetID());
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("CreateNewBlock: Failed to detect masternode to pay\n");
|
LogPrintf("CreateNewBlock: Failed to detect masternode to pay\n");
|
||||||
hasPayment = false;
|
hasPayment = false;
|
||||||
}
|
}
|
||||||
@ -5357,7 +5373,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
|
|
||||||
int64 blockValue = GetBlockValue(pindexPrev->nBits, pindexPrev->nHeight, nFees);
|
int64 blockValue = GetBlockValue(pindexPrev->nBits, pindexPrev->nHeight, nFees);
|
||||||
int64 masternodePayment = GetMasternodePayment(pindexPrev->nHeight+1, blockValue);
|
int64 masternodePayment = GetMasternodePayment(pindexPrev->nHeight+1, blockValue);
|
||||||
|
|
||||||
//create masternode payment
|
//create masternode payment
|
||||||
if(payments > 1){
|
if(payments > 1){
|
||||||
pblock->vtx[0].vout[payments-1].nValue = masternodePayment;
|
pblock->vtx[0].vout[payments-1].nValue = masternodePayment;
|
||||||
@ -5374,7 +5390,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
pblock->nNonce = 0;
|
pblock->nNonce = 0;
|
||||||
pblock->vtx[0].vin[0].scriptSig = CScript() << OP_0 << OP_0;
|
pblock->vtx[0].vin[0].scriptSig = CScript() << OP_0 << OP_0;
|
||||||
pblocktemplate->vTxSigOps[0] = pblock->vtx[0].GetLegacySigOpCount();
|
pblocktemplate->vTxSigOps[0] = pblock->vtx[0].GetLegacySigOpCount();
|
||||||
|
|
||||||
|
|
||||||
CBlockIndex indexDummy(*pblock);
|
CBlockIndex indexDummy(*pblock);
|
||||||
indexDummy.pprev = pindexPrev;
|
indexDummy.pprev = pindexPrev;
|
||||||
|
@ -59,7 +59,7 @@ void ProcessMessageMasternode(CNode* pfrom, std::string& strCommand, CDataStream
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isLocal = false; // addr.IsRFC1918();
|
bool isLocal = addr.IsRFC1918();
|
||||||
std::string vchPubKey(pubkey.begin(), pubkey.end());
|
std::string vchPubKey(pubkey.begin(), pubkey.end());
|
||||||
std::string vchPubKey2(pubkey2.begin(), pubkey2.end());
|
std::string vchPubKey2(pubkey2.begin(), pubkey2.end());
|
||||||
|
|
||||||
|
@ -187,14 +187,30 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletModel::UnlockContext ctx(model->requestUnlock(true));
|
// request unlock only if was locked or unlocked for mixing:
|
||||||
if(!ctx.isValid())
|
// this way we let users unlock by walletpassphrase or by menu
|
||||||
|
// and make many transactions while unlocking through this dialog
|
||||||
|
// will call relock
|
||||||
|
WalletModel::EncryptionStatus encStatus = model->getEncryptionStatus();
|
||||||
|
if(encStatus == model->Locked ||
|
||||||
|
encStatus == model->UnlockedForAnonymizationOnly)
|
||||||
{
|
{
|
||||||
// Unlock wallet was cancelled
|
WalletModel::UnlockContext ctx(model->requestUnlock(true));
|
||||||
fNewRecipientAllowed = true;
|
if(!ctx.isValid())
|
||||||
|
{
|
||||||
|
// Unlock wallet was cancelled
|
||||||
|
fNewRecipientAllowed = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
send(recipients);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// already unlocked or not encrypted at all
|
||||||
|
send(recipients);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendCoinsDialog::send(QList<SendCoinsRecipient> recipients)
|
||||||
|
{
|
||||||
WalletModel::SendCoinsReturn sendstatus;
|
WalletModel::SendCoinsReturn sendstatus;
|
||||||
if (!model->getOptionsModel() || !model->getOptionsModel()->getCoinControlFeatures())
|
if (!model->getOptionsModel() || !model->getOptionsModel()->getCoinControlFeatures())
|
||||||
sendstatus = model->sendCoins(recipients);
|
sendstatus = model->sendCoins(recipients);
|
||||||
|
@ -50,6 +50,7 @@ private:
|
|||||||
bool fNewRecipientAllowed;
|
bool fNewRecipientAllowed;
|
||||||
bool boolCheckedBalance;
|
bool boolCheckedBalance;
|
||||||
int cachedNumBlocks;
|
int cachedNumBlocks;
|
||||||
|
void send(QList<SendCoinsRecipient> recipients);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_sendButton_clicked();
|
void on_sendButton_clicked();
|
||||||
|
@ -23,10 +23,10 @@ Value darksend(const Array& params, bool fHelp)
|
|||||||
"darkcoinaddress, reset, or auto (AutoDenominate)"
|
"darkcoinaddress, reset, or auto (AutoDenominate)"
|
||||||
"<amount> is a real and is rounded to the nearest 0.00000001"
|
"<amount> is a real and is rounded to the nearest 0.00000001"
|
||||||
+ HelpRequiringPassphrase());
|
+ HelpRequiringPassphrase());
|
||||||
|
|
||||||
if(fMasterNode)
|
if(fMasterNode)
|
||||||
return "DarkSend is not supported from masternodes";
|
return "DarkSend is not supported from masternodes";
|
||||||
|
|
||||||
if (pwalletMain->IsLocked())
|
if (pwalletMain->IsLocked())
|
||||||
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");
|
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");
|
||||||
|
|
||||||
@ -89,9 +89,9 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
|
|
||||||
if (fHelp ||
|
if (fHelp ||
|
||||||
(strCommand != "start" && strCommand != "start-alias" && strCommand != "start-many" && strCommand != "stop" && strCommand != "stop-alias" && strCommand != "stop-many" && strCommand != "list" && strCommand != "list-conf" && strCommand != "count" && strCommand != "enforce"
|
(strCommand != "start" && strCommand != "start-alias" && strCommand != "start-many" && strCommand != "stop" && strCommand != "stop-alias" && strCommand != "stop-many" && strCommand != "list" && strCommand != "list-conf" && strCommand != "count" && strCommand != "enforce"
|
||||||
&& strCommand != "debug" && strCommand != "current" && strCommand != "winners" && strCommand != "genkey" && strCommand != "connect"))
|
&& strCommand != "debug" && strCommand != "current" && strCommand != "winners" && strCommand != "genkey" && strCommand != "connect" && strCommand != "outputs"))
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"masternode <start|start-alias|start-many|stop|stop-alias|stop-many|list|list-conf|count|debug|current|winners|genkey|enforce> passphrase\n");
|
"masternode <start|start-alias|start-many|stop|stop-alias|stop-many|list|list-conf|count|debug|current|winners|genkey|enforce|outputs> [passphrase]\n");
|
||||||
|
|
||||||
if (strCommand == "stop")
|
if (strCommand == "stop")
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"Your wallet is locked, passphrase is required\n");
|
"Your wallet is locked, passphrase is required\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pwalletMain->Unlock(strWalletPass)){
|
if(!pwalletMain->Unlock(strWalletPass)){
|
||||||
return "incorrect passphrase";
|
return "incorrect passphrase";
|
||||||
}
|
}
|
||||||
@ -118,10 +118,10 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
return "stop failed: " + errorMessage;
|
return "stop failed: " + errorMessage;
|
||||||
}
|
}
|
||||||
pwalletMain->Lock();
|
pwalletMain->Lock();
|
||||||
|
|
||||||
if(activeMasternode.status == MASTERNODE_STOPPED) return "successfully stopped masternode";
|
if(activeMasternode.status == MASTERNODE_STOPPED) return "successfully stopped masternode";
|
||||||
if(activeMasternode.status == MASTERNODE_NOT_CAPABLE) return "not capable masternode";
|
if(activeMasternode.status == MASTERNODE_NOT_CAPABLE) return "not capable masternode";
|
||||||
|
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strCommand == "list")
|
if (strCommand == "list")
|
||||||
{
|
{
|
||||||
std::string strCommand = "active";
|
std::string strCommand = "active";
|
||||||
|
|
||||||
if (params.size() == 2){
|
if (params.size() == 2){
|
||||||
@ -248,7 +248,7 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
|
|
||||||
Object obj;
|
Object obj;
|
||||||
BOOST_FOREACH(CMasterNode mn, darkSendMasterNodes) {
|
BOOST_FOREACH(CMasterNode mn, darkSendMasterNodes) {
|
||||||
mn.Check();
|
mn.Check();
|
||||||
|
|
||||||
if(strCommand == "active"){
|
if(strCommand == "active"){
|
||||||
obj.push_back(Pair(mn.addr.ToString().c_str(), (int)mn.IsEnabled()));
|
obj.push_back(Pair(mn.addr.ToString().c_str(), (int)mn.IsEnabled()));
|
||||||
@ -290,7 +290,7 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"Your wallet is locked, passphrase is required\n");
|
"Your wallet is locked, passphrase is required\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pwalletMain->Unlock(strWalletPass)){
|
if(!pwalletMain->Unlock(strWalletPass)){
|
||||||
return "incorrect passphrase";
|
return "incorrect passphrase";
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
activeMasternode.ManageStatus();
|
activeMasternode.ManageStatus();
|
||||||
pwalletMain->Lock();
|
pwalletMain->Lock();
|
||||||
|
|
||||||
if(activeMasternode.status == MASTERNODE_REMOTELY_ENABLED) return "masternode started remotely";
|
if(activeMasternode.status == MASTERNODE_REMOTELY_ENABLED) return "masternode started remotely";
|
||||||
if(activeMasternode.status == MASTERNODE_INPUT_TOO_NEW) return "masternode input must have at least 15 confirmations";
|
if(activeMasternode.status == MASTERNODE_INPUT_TOO_NEW) return "masternode input must have at least 15 confirmations";
|
||||||
if(activeMasternode.status == MASTERNODE_STOPPED) return "masternode is stopped";
|
if(activeMasternode.status == MASTERNODE_STOPPED) return "masternode is stopped";
|
||||||
@ -364,9 +364,9 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
return statusObj;
|
return statusObj;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strCommand == "start-many")
|
if (strCommand == "start-many")
|
||||||
{
|
{
|
||||||
if(pwalletMain->IsLocked()) {
|
if(pwalletMain->IsLocked()) {
|
||||||
SecureString strWalletPass;
|
SecureString strWalletPass;
|
||||||
strWalletPass.reserve(100);
|
strWalletPass.reserve(100);
|
||||||
@ -442,9 +442,22 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == "outputs"){
|
||||||
|
// Find possible candidates
|
||||||
|
vector<COutput> possibleCoins = activeMasternode.SelectCoinsMasternode();
|
||||||
|
|
||||||
|
Object obj;
|
||||||
|
BOOST_FOREACH(COutput& out, possibleCoins) {
|
||||||
|
obj.push_back(Pair(out.tx->GetHash().ToString().c_str(), boost::lexical_cast<std::string>(out.i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (strCommand == "create")
|
if (strCommand == "create")
|
||||||
{
|
{
|
||||||
|
|
||||||
return "Not implemented yet, please look at the documentation for instructions on masternode creation";
|
return "Not implemented yet, please look at the documentation for instructions on masternode creation";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,7 +472,7 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strCommand == "genkey")
|
if (strCommand == "genkey")
|
||||||
{
|
{
|
||||||
CKey secret;
|
CKey secret;
|
||||||
secret.MakeNewKey(false);
|
secret.MakeNewKey(false);
|
||||||
|
|
||||||
@ -467,7 +480,7 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strCommand == "winners")
|
if (strCommand == "winners")
|
||||||
{
|
{
|
||||||
Object obj;
|
Object obj;
|
||||||
|
|
||||||
for(int nHeight = pindexBest->nHeight-10; nHeight < pindexBest->nHeight+20; nHeight++)
|
for(int nHeight = pindexBest->nHeight-10; nHeight < pindexBest->nHeight+20; nHeight++)
|
||||||
@ -499,7 +512,7 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
} else {
|
} else {
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"Masternode address required\n");
|
"Masternode address required\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
CService addr = CService(strAddress);
|
CService addr = CService(strAddress);
|
||||||
|
|
||||||
|
@ -1354,7 +1354,7 @@ Value walletpassphrase(const Array& params, bool fHelp)
|
|||||||
{
|
{
|
||||||
if (pwalletMain->IsCrypted() && (fHelp || params.size() < 2 || params.size() > 3))
|
if (pwalletMain->IsCrypted() && (fHelp || params.size() < 2 || params.size() > 3))
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"walletpassphrase <passphrase> <timeout> [anonymizenonly]\n"
|
"walletpassphrase <passphrase> <timeout> [anonymizenonly=false]\n"
|
||||||
"Stores the wallet decryption key in memory for <timeout> seconds.\n"
|
"Stores the wallet decryption key in memory for <timeout> seconds.\n"
|
||||||
"if [anonymizeonly] is true sending functions are disabled.");
|
"if [anonymizeonly] is true sending functions are disabled.");
|
||||||
if (fHelp)
|
if (fHelp)
|
||||||
@ -1388,7 +1388,7 @@ Value walletpassphrase(const Array& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"walletpassphrase <passphrase> <timeout> [anonymizeonly]\n"
|
"walletpassphrase <passphrase> <timeout> [anonymizeonly=false]\n"
|
||||||
"Stores the wallet decryption key in memory for <timeout> seconds.\n"
|
"Stores the wallet decryption key in memory for <timeout> seconds.\n"
|
||||||
"if [anonymizeonly] is true sending functions are disabled.");
|
"if [anonymizeonly] is true sending functions are disabled.");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user