merge downstream 0.11.1

This commit is contained in:
vertoe 2015-02-06 00:39:58 +01:00
commit 8fc3f84ad8
20 changed files with 227 additions and 121 deletions

View File

@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 11)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_BUILD, 8)
define(_CLIENT_VERSION_BUILD, 10)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2015)
AC_INIT([Darkcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@darkcoin.io],[darkcoin])

View File

@ -12,7 +12,7 @@
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 11
#define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_BUILD 8
#define CLIENT_VERSION_BUILD 10

View File

@ -5,7 +5,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "core.h"
#include "util.h"
std::string COutPoint::ToString() const
@ -286,4 +285,4 @@ void CBlock::print() const
for (unsigned int i = 0; i < vMerkleTree.size(); i++)
LogPrintf("%s ", vMerkleTree[i].ToString());
LogPrintf("\n");
}
}

View File

@ -19,7 +19,8 @@ static const int64_t DARKSEND_COLLATERAL = (0.1*COIN);
static const int64_t DARKSEND_FEE = (0.0125*COIN);
static const int64_t DARKSEND_POOL_MAX = (999.99*COIN);
#define INSTANTX_SIGNATURES_REQUIRED 9
#define INSTANTX_SIGNATURES_REQUIRED 6
#define INSTANTX_SIGNATURES_TOTAL 10
#define MASTERNODE_NOT_PROCESSED 0 // initial state
#define MASTERNODE_IS_CAPABLE 1

View File

@ -1319,41 +1319,6 @@ bool CDarkSendPool::GetBlockHash(uint256& hash, int nBlockHeight)
return false;
}
//Get the last hash that matches the modulus given. Processed in reverse order
bool CDarkSendPool::GetLastValidBlockHash(uint256& hash, int mod, int nBlockHeight)
{
if(unitTest){
hash.SetHex("00000000001432b4910722303bff579d0445fa23325bdc34538bdb226718ba79");
return true;
}
const CBlockIndex *BlockLastSolved = chainActive.Tip();
const CBlockIndex *BlockReading = chainActive.Tip();
if (chainActive.Tip() == NULL) return false;
if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || chainActive.Tip()->nHeight+1 < nBlockHeight) return false;
int nBlocksAgo = 0;
if(nBlockHeight > 0) nBlocksAgo = (chainActive.Tip()->nHeight+1)-nBlockHeight;
assert(nBlocksAgo >= 0);
int n = 0;
for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
if(BlockReading->nHeight % mod == 0) {
if(n >= nBlocksAgo){
hash = BlockReading->GetBlockHash();
return true;
}
n++;
}
if (BlockReading->pprev == NULL) { assert(BlockReading); break; }
BlockReading = BlockReading->pprev;
}
return false;
}
void CDarkSendPool::NewBlock()
{
if(fDebug) LogPrintf("CDarkSendPool::NewBlock \n");

View File

@ -222,7 +222,7 @@ class CDarksendSession
class CDarkSendPool
{
public:
static const int MIN_PEER_PROTO_VERSION = 70058;
static const int MIN_PEER_PROTO_VERSION = 70060;
// clients entries
std::vector<CDarkSendEntry> myEntries;

View File

@ -702,7 +702,7 @@ bool AppInit2(boost::thread_group& threadGroup)
}
//ignore masternodes below protocol version
nMasternodeMinProtocol = GetArg("-masternodeminprotocol", 0);
nMasternodeMinProtocol = GetArg("-masternodeminprotocol", 70051);
int64_t nStart;

View File

@ -35,6 +35,7 @@ int nCompleteTXLocks;
void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
{
if(fLiteMode) return; //disable all darksend/masternode related functionality
if(fLargeWorkForkFound || fLargeWorkInvalidChainFound) return;
if (strCommand == "txlreq")
{
@ -104,11 +105,13 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
if (i != mapTxLocks.end()){
//we only care if we have a complete tx lock
if((*i).second.CountSignatures() >= INSTANTX_SIGNATURES_REQUIRED){
LogPrintf("ProcessMessageInstantX::txlreq - Found Existing Complete IX Lock\n");
if(!CheckForConflictingLocks(tx)){
LogPrintf("ProcessMessageInstantX::txlreq - Found Existing Complete IX Lock\n");
CValidationState state;
DisconnectBlockAndInputs(state, tx);
mapTxLockReq.insert(make_pair(tx.GetHash(), tx));
CValidationState state;
DisconnectBlockAndInputs(state, tx);
mapTxLockReq.insert(make_pair(tx.GetHash(), tx));
}
}
}
@ -229,7 +232,8 @@ int64_t CreateNewLock(CTransaction tx)
CTransactionLock newLock;
newLock.nBlockHeight = nBlockHeight;
newLock.nExpiration = GetTime()+(60*60);
newLock.nExpiration = GetTime()+(60*15); //locks expire after 15 minutes (6 confirmations)
newLock.nTimeout = GetTime()+(60*5);
newLock.txHash = tx.GetHash();
mapTxLocks.insert(make_pair(tx.GetHash(), newLock));
} else {
@ -282,9 +286,9 @@ bool ProcessConsensusVote(CConsensusVote& ctx)
return false;
}
if(n > 10)
if(n > INSTANTX_SIGNATURES_TOTAL)
{
LogPrintf("InstantX::ProcessConsensusVote - Masternode not in the top 10 (%d)\n", n);
LogPrintf("InstantX::ProcessConsensusVote - Masternode not in the top %d (%d)\n", INSTANTX_SIGNATURES_TOTAL, n);
return false;
}
@ -300,6 +304,7 @@ bool ProcessConsensusVote(CConsensusVote& ctx)
CTransactionLock newLock;
newLock.nBlockHeight = 0;
newLock.nExpiration = GetTime()+(60*60);
newLock.nTimeout = GetTime()+(60*5);
newLock.txHash = ctx.txHash;
mapTxLocks.insert(make_pair(ctx.txHash, newLock));
} else {
@ -311,34 +316,45 @@ bool ProcessConsensusVote(CConsensusVote& ctx)
if (i != mapTxLocks.end()){
(*i).second.AddSignature(ctx);
#ifdef ENABLE_WALLET
if(pwalletMain){
//when we get back signatures, we'll count them as requests. Otherwise the client will think it didn't propagate.
if(pwalletMain->mapRequestCount.count(ctx.txHash))
pwalletMain->mapRequestCount[ctx.txHash]++;
}
#endif
if(fDebug) LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Votes %d - %s !\n", (*i).second.CountSignatures(), ctx.GetHash().ToString().c_str());
if((*i).second.CountSignatures() >= INSTANTX_SIGNATURES_REQUIRED){
if(fDebug) LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Is Complete %s !\n", (*i).second.GetHash().ToString().c_str());
#ifdef ENABLE_WALLET
if(pwalletMain){
if(pwalletMain->UpdatedTransaction((*i).second.txHash)){
nCompleteTXLocks++;
}
}
#endif
CTransaction& tx = mapTxLockReq[ctx.txHash];
if(!CheckForConflictingLocks(tx)){
if(mapTxLockReq.count(ctx.txHash)){
CTransaction& tx = mapTxLockReq[ctx.txHash];
BOOST_FOREACH(const CTxIn& in, tx.vin){
if(!mapLockedInputs.count(in.prevout)){
mapLockedInputs.insert(make_pair(in.prevout, ctx.txHash));
#ifdef ENABLE_WALLET
if(pwalletMain){
if(pwalletMain->UpdatedTransaction((*i).second.txHash)){
nCompleteTXLocks++;
}
}
}
#endif
// resolve conflicts
if(mapTxLockReq.count(ctx.txHash)){
BOOST_FOREACH(const CTxIn& in, tx.vin){
if(!mapLockedInputs.count(in.prevout)){
mapLockedInputs.insert(make_pair(in.prevout, ctx.txHash));
}
}
}
//if this tx lock was rejected, we need to remove the conflicting blocks
if(mapTxLockReqRejected.count((*i).second.txHash)){
CValidationState state;
DisconnectBlockAndInputs(state, mapTxLockReqRejected[(*i).second.txHash]);
// resolve conflicts
//if this tx lock was rejected, we need to remove the conflicting blocks
if(mapTxLockReqRejected.count((*i).second.txHash)){
CValidationState state;
DisconnectBlockAndInputs(state, mapTxLockReqRejected[(*i).second.txHash]);
}
}
}
return true;
@ -348,6 +364,28 @@ bool ProcessConsensusVote(CConsensusVote& ctx)
return false;
}
bool CheckForConflictingLocks(CTransaction& tx)
{
/*
It's possible (very unlikely though) to get 2 conflicting transaction locks approved by the network.
In that case, they will cancel each other out.
Blocks could have been rejected during this time, which is OK. After they cancel out, the client will
rescan the blocks and find they're acceptable and then take the chain with the most work.
*/
BOOST_FOREACH(const CTxIn& in, tx.vin){
if(mapLockedInputs.count(in.prevout)){
if(mapLockedInputs[in.prevout] != tx.GetHash()){
LogPrintf("InstantX::CheckForConflictingLocks - found two complete conflicting locks - removing both. %s %s", tx.GetHash().ToString().c_str(), mapLockedInputs[in.prevout].ToString().c_str());
if(mapTxLocks.count(tx.GetHash())) mapTxLocks[tx.GetHash()].nExpiration = GetTime();
if(mapTxLocks.count(mapLockedInputs[in.prevout])) mapTxLocks[mapLockedInputs[in.prevout]].nExpiration = GetTime();
return true;
}
}
}
return false;
}
int64_t GetAverageVoteTime()
{
@ -481,9 +519,9 @@ bool CTransactionLock::SignaturesValid()
return false;
}
if(n > 10)
if(n > INSTANTX_SIGNATURES_TOTAL)
{
LogPrintf("InstantX::DoConsensusVote - Masternode not in the top 10\n");
LogPrintf("InstantX::DoConsensusVote - Masternode not in the top %s\n", INSTANTX_SIGNATURES_TOTAL);
return false;
}
@ -503,6 +541,9 @@ void CTransactionLock::AddSignature(CConsensusVote cv)
int CTransactionLock::CountSignatures()
{
return 10;
/*
Only count signatures where the BlockHeight matches the transaction's blockheight.
The votes have no proof it's the correct blockheight

View File

@ -23,7 +23,7 @@ class CConsensusVote;
class CTransaction;
class CTransactionLock;
static const int MIN_INSTANTX_PROTO_VERSION = 70058;
static const int MIN_INSTANTX_PROTO_VERSION = 70060;
extern map<uint256, CTransaction> mapTxLockReq;
extern map<uint256, CTransactionLock> mapTxLocks;
@ -35,6 +35,9 @@ int64_t CreateNewLock(CTransaction tx);
bool IsIXTXValid(const CTransaction& txCollateral);
// if two conflicting locks are approved by the network, they will cancel out
bool CheckForConflictingLocks(CTransaction& tx);
void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
//check if we need to vote on this transaction
@ -77,6 +80,7 @@ public:
uint256 txHash;
std::vector<CConsensusVote> vecConsensusVotes;
int nExpiration;
int nTimeout;
bool SignaturesValid();
int CountSignatures();

View File

@ -1170,23 +1170,31 @@ int CMerkleTx::GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const
return chainActive.Height() - pindex->nHeight + 1;
}
int CMerkleTx::IsTransactionLocked() const
int CMerkleTx::GetTransactionLockSignatures() const
{
if(fLargeWorkForkFound || fLargeWorkInvalidChainFound) return -2;
if(nInstantXDepth == 0) return -1;
//compile consessus vote
std::map<uint256, CTransactionLock>::iterator i = mapTxLocks.find(GetHash());
if (i != mapTxLocks.end()){
return (*i).second.CountSignatures();
}
return -1;
}
bool CMerkleTx::IsTransactionLockTimedOut() const
{
if(nInstantXDepth == 0) return 0;
//compile consessus vote
std::map<uint256, CTransactionLock>::iterator i = mapTxLocks.find(GetHash());
if (i != mapTxLocks.end()){
if((*i).second.CountSignatures() >= INSTANTX_SIGNATURES_REQUIRED){
LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Is Complete %s\n", (*i).second.GetHash().ToString().c_str());
return nInstantXDepth;
} else {
LogPrintf("InstantX::ProcessConsensusVote - Incomplete TX Lock %d %s\n", (*i).second.CountSignatures(), (*i).second.GetHash().ToString().c_str());
return 0;
}
return GetTime() > (*i).second.nTimeout;
}
return 0;
return false;
}
int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet, bool enableIX) const
@ -1198,8 +1206,10 @@ int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet, bool enableIX) const
if(enableIX){
if (nResult < 6){
int minConfirms = IsTransactionLocked();
return minConfirms+nResult;
int signatures = GetTransactionLockSignatures();
if(signatures >= INSTANTX_SIGNATURES_REQUIRED){
return nInstantXDepth+nResult;
}
}
}
@ -2468,7 +2478,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew) {
*/
bool DisconnectBlockAndInputs(CValidationState &state, CTransaction txLock)
{
// All modifications to the coin state will be done in this cache.
// Only when all have succeeded, we push it to pcoinsTip.
CCoinsViewCache view(*pcoinsTip, true);
@ -2815,13 +2825,16 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
// ----------- instantX transaction scanning -----------
BOOST_FOREACH(const CTransaction& tx, block.vtx){
if (!tx.IsCoinBase()){
BOOST_FOREACH(const CTxIn& in, tx.vin){
if(mapLockedInputs.count(in.prevout)){
if(mapLockedInputs[in.prevout] != tx.GetHash()){
return state.DoS(0, error("CheckBlock() : found conflicting transaction with transaction lock"),
REJECT_INVALID, "conflicting-tx-ix");
if(!fLargeWorkForkFound && !fLargeWorkInvalidChainFound){
BOOST_FOREACH(const CTransaction& tx, block.vtx){
if (!tx.IsCoinBase()){
//only reject blocks when it's based on complete consensus
BOOST_FOREACH(const CTxIn& in, tx.vin){
if(mapLockedInputs.count(in.prevout)){
if(mapLockedInputs[in.prevout] != tx.GetHash()){
return state.DoS(0, error("CheckBlock() : found conflicting transaction with transaction lock"),
REJECT_INVALID, "conflicting-tx-ix");
}
}
}
}
@ -2839,7 +2852,8 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
if(block.nTime > START_MASTERNODE_PAYMENTS) MasternodePayments = true;
}
if(MasternodePayments)
if(MasternodePayments && !fLargeWorkForkFound && !fLargeWorkInvalidChainFound)
{
LOCK2(cs_main, mempool.cs);
@ -3098,6 +3112,7 @@ bool ProcessBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDiskBl
return false;
}
*/
// Check for duplicate
uint256 hash = pblock->GetHash();
if (mapBlockIndex.count(hash))

View File

@ -108,6 +108,10 @@ extern int nScriptCheckThreads;
extern bool fTxIndex;
extern unsigned int nCoinCacheSize;
extern bool fLargeWorkForkFound;
extern bool fLargeWorkInvalidChainFound;
// Minimum disk space required - used in CheckDiskSpace()
static const uint64_t nMinDiskSpace = 52428800;
@ -485,7 +489,10 @@ public:
bool IsInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
int GetBlocksToMaturity() const;
bool AcceptToMemoryPool(bool fLimitFree=true);
int IsTransactionLocked() const;
int GetTransactionLockSignatures() const;
bool IsTransactionLockTimedOut() const;
};

View File

@ -18,6 +18,8 @@ map<uint256, int> mapSeenMasternodeScanningErrors;
std::map<CNetAddr, int64_t> askedForMasternodeList;
// which masternodes we've asked for
std::map<COutPoint, int64_t> askedForMasternodeListEntry;
// cache block hashes as we calculate them
std::map<int64_t, uint256> mapCacheBlockHashes;
// manage the masternode connections
void ProcessMasternodeConnections(){
@ -500,6 +502,40 @@ int GetMasternodeRank(CTxIn& vin, int64_t nBlockHeight, int minProtocol)
return -1;
}
//Get the last hash that matches the modulus given. Processed in reverse order
bool GetBlockHash(uint256& hash, int nBlockHeight)
{
if(mapCacheBlockHashes.count(nBlockHeight)){
hash = mapCacheBlockHashes[nBlockHeight];
return true;
}
const CBlockIndex *BlockLastSolved = chainActive.Tip();
const CBlockIndex *BlockReading = chainActive.Tip();
if (chainActive.Tip() == NULL) return false;
if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || chainActive.Tip()->nHeight+1 < nBlockHeight) return false;
int nBlocksAgo = 0;
if(nBlockHeight > 0) nBlocksAgo = (chainActive.Tip()->nHeight+1)-nBlockHeight;
assert(nBlocksAgo >= 0);
int n = 0;
for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
if(n >= nBlocksAgo){
hash = BlockReading->GetBlockHash();
mapCacheBlockHashes[nBlockHeight-n] = hash;
return true;
}
n++;
if (BlockReading->pprev == NULL) { assert(BlockReading); break; }
BlockReading = BlockReading->pprev;
}
return false;
}
//
// Deterministically calculate a given "score" for a masternode depending on how close it's hash is to
// the proof of work for that block. The further away they are the better, the furthest will win the election
@ -510,8 +546,11 @@ uint256 CMasterNode::CalculateScore(int mod, int64_t nBlockHeight)
if(chainActive.Tip() == NULL) return 0;
uint256 hash = 0;
if(!darkSendPool.GetLastValidBlockHash(hash, mod, nBlockHeight)) return 0;
uint256 aux = vin.prevout.hash;
if(!GetBlockHash(hash, nBlockHeight)) return 0;
uint256 hash2 = HashX11(BEGIN(hash), END(hash));
uint256 hash3 = HashX11(BEGIN(hash), END(aux));
// we'll make a 4 dimensional point in space
// the closest masternode to that point wins
@ -528,11 +567,11 @@ uint256 CMasterNode::CalculateScore(int mod, int64_t nBlockHeight)
memcpy(&i3, &a3, 1);
memcpy(&i4, &a4, 1);
//split up our mn hash
uint64_t b1 = vin.prevout.hash.Get64(0);
uint64_t b2 = vin.prevout.hash.Get64(1);
uint64_t b3 = vin.prevout.hash.Get64(2);
uint64_t b4 = vin.prevout.hash.Get64(3);
//split up our mn-hash+aux into 4
uint64_t b1 = hash3.Get64(0);
uint64_t b2 = hash3.Get64(1);
uint64_t b3 = hash3.Get64(2);
uint64_t b4 = hash3.Get64(3);
//move mn hash around
b1 <<= (i1 % 64);

View File

@ -42,6 +42,7 @@ extern std::vector<CMasterNode> vecMasternodes;
extern CMasternodePayments masternodePayments;
extern std::vector<CTxIn> vecMasternodeAskedFor;
extern map<uint256, int> mapSeenMasternodeVotes;
extern map<int64_t, uint256> mapCacheBlockHashes;
// manage the masternode connections

View File

@ -540,6 +540,7 @@ void static BitcoinMiner(CWallet *pwallet)
//
unsigned int nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
CBlockIndex* pindexPrev = chainActive.Tip();
if(!pindexPrev) break;
auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey));
if (!pblocktemplate.get())
@ -547,6 +548,7 @@ void static BitcoinMiner(CWallet *pwallet)
CBlock *pblock = &pblocktemplate->block;
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
LogPrintf("Running DarkcoinMiner with %u transactions in block (%u bytes)\n", pblock->vtx.size(),
::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));

View File

@ -1869,9 +1869,6 @@ void RelayTransactionLockReq(const CTransaction& tx, const uint256& hash, bool r
if(!relayToAll && !pnode->fRelayTxes)
continue;
//there's no requests for transactions locks, so we should show it was propagated correctly
//pwalletMain->mapRequestCount[tx.GetHash()]++;
pnode->PushMessage("txlreq", tx);
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>960</width>
<height>541</height>
<height>585</height>
</rect>
</property>
<property name="minimumSize">
@ -326,7 +326,7 @@
</size>
</property>
<property name="value">
<number>24</number>
<number>0</number>
</property>
</widget>
</item>

View File

@ -287,13 +287,22 @@ void OverviewPage::updateDarksendProgress()
// calculate parts of the progress, each of them shouldn't be higher than 1:
// mixing progress of denominated balance
float denomPart = (float)pwalletMain->GetNormalizedAnonymizedBalance() / pwalletMain->GetDenominatedBalance();
denomPart = denomPart > 1 ? 1 : denomPart;
int64_t denominatedBalance = pwalletMain->GetDenominatedBalance();
float denomPart = 0;
if(denominatedBalance > 0)
{
denomPart = (float)pwalletMain->GetNormalizedAnonymizedBalance() / pwalletMain->GetDenominatedBalance();
denomPart = denomPart > 1 ? 1 : denomPart;
}
// % of fully anonymized balance
float anonPart = (float)pwalletMain->GetAnonymizedBalance() / nMaxToAnonymize;
// if anonPart is > 1 then we are done, make denomPart equal 1 too
anonPart = anonPart > 1 ? (denomPart = 1, 1) : anonPart;
float anonPart = 0;
if(nMaxToAnonymize > 0)
{
anonPart = (float)pwalletMain->GetAnonymizedBalance() / nMaxToAnonymize;
// if anonPart is > 1 then we are done, make denomPart equal 1 too
anonPart = anonPart > 1 ? (denomPart = 1, 1) : anonPart;
}
// apply some weights to them (sum should be <=100) and calculate the whole progress
int progress = 80 * denomPart + 20 * anonPart;

View File

@ -31,17 +31,43 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
}
else
{
int signatures = wtx.GetTransactionLockSignatures();
QString strUsingIX = "";
if(wtx.IsTransactionLocked()){
int nDepth = wtx.GetDepthInMainChain();
if (nDepth < 0)
return tr("conflicted");
else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
return tr("%1/offline (verified via instantx)").arg(nDepth);
else if (nDepth < 6)
return tr("%1/confirmed (verified via instantx)").arg(nDepth);
else
return tr("%1 confirmations (verified via instantx)").arg(nDepth);
if(signatures >= 0){
if(signatures >= INSTANTX_SIGNATURES_REQUIRED){
int nDepth = wtx.GetDepthInMainChain();
if (nDepth < 0)
return tr("conflicted");
else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
return tr("%1/offline (verified via instantx)").arg(nDepth);
else if (nDepth < 6)
return tr("%1/confirmed (verified via instantx)").arg(nDepth);
else
return tr("%1 confirmations (verified via instantx)").arg(nDepth);
} else {
if(!wtx.IsTransactionLockTimedOut()){
int nDepth = wtx.GetDepthInMainChain();
if (nDepth < 0)
return tr("conflicted");
else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
return tr("%1/offline (InstantX verification in progress - %2 of %3 signatures)").arg(nDepth).arg(signatures).arg(INSTANTX_SIGNATURES_TOTAL);
else if (nDepth < 6)
return tr("%1/confirmed (InstantX verification in progress - %2 of %3 signatures )").arg(nDepth).arg(signatures).arg(INSTANTX_SIGNATURES_TOTAL);
else
return tr("%1 confirmations (InstantX verification in progress - %2 of %3 signatures)").arg(nDepth).arg(signatures).arg(INSTANTX_SIGNATURES_TOTAL);
} else {
int nDepth = wtx.GetDepthInMainChain();
if (nDepth < 0)
return tr("conflicted");
else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
return tr("%1/offline (InstantX verification failed)").arg(nDepth);
else if (nDepth < 6)
return tr("%1/confirmed (InstantX verification failed)").arg(nDepth);
else
return tr("%1 confirmations").arg(nDepth);
}
}
} else {
int nDepth = wtx.GetDepthInMainChain();
if (nDepth < 0)

View File

@ -43,7 +43,7 @@ void EnsureWalletIsUnlocked()
void WalletTxToJSON(const CWalletTx& wtx, Object& entry)
{
int confirms = wtx.GetDepthInMainChain();
int confirms = wtx.GetDepthInMainChain(false);
entry.push_back(Pair("confirmations", confirms));
if (wtx.IsCoinBase())
entry.push_back(Pair("generated", true));
@ -1116,7 +1116,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
Object entry;
entry.push_back(Pair("account", strSentAccount));
MaybePushAddress(entry, s.first);
entry.push_back(Pair("category", "send"));
entry.push_back(Pair("category", wtx.IsDenominated() ? "darksent" : "send"));
entry.push_back(Pair("amount", ValueFromAmount(-s.second)));
entry.push_back(Pair("fee", ValueFromAmount(-nFee)));
if (fLong)

View File

@ -27,13 +27,13 @@ extern const std::string CLIENT_DATE;
// network protocol versioning
//
static const int PROTOCOL_VERSION = 70058;
static const int PROTOCOL_VERSION = 70060;
// intial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
// disconnect from peers older than this proto version
static const int MIN_PEER_PROTO_VERSION = 70046;
static const int MIN_PEER_PROTO_VERSION = 70051;
// nTime field added to CAddress, starting with this version;
// if possible, avoid requesting addresses nodes older than this