various improvements to IX

This commit is contained in:
Evan Duffield 2015-02-01 08:53:49 -07:00
parent 3edcf4beda
commit a3077626b5
14 changed files with 137 additions and 238 deletions

View File

@ -39,17 +39,6 @@ void CActiveMasternode::ManageStatus()
service = CService(strMasterNodeAddr); service = CService(strMasterNodeAddr);
} }
if(
(Params().NetworkID() == CChainParams::TESTNET && service.GetPort() != 19999) ||
(Params().NetworkID() == CChainParams::REGTEST && service.GetPort() != 19999) ||
(Params().NetworkID() == CChainParams::MAIN && service.GetPort() != 9999) )
{
notCapableReason = "Invalid port: " + boost::lexical_cast<string>(service.GetPort()) + " -only 9999 or 19999 are supported.";
status = MASTERNODE_NOT_CAPABLE;
LogPrintf("CActiveMasternode::ManageStatus() - not capable: %s\n", notCapableReason.c_str());
return;
}
LogPrintf("CActiveMasternode::ManageStatus() - Checking inbound connection to '%s'\n", service.ToString().c_str()); LogPrintf("CActiveMasternode::ManageStatus() - Checking inbound connection to '%s'\n", service.ToString().c_str());
if(Params().NetworkID() != CChainParams::REGTEST){ if(Params().NetworkID() != CChainParams::REGTEST){

View File

@ -1199,7 +1199,7 @@ bool AppInit2(boost::thread_group& threadGroup)
bool fEnableInstantX = GetBoolArg("-enableinstantx", true); bool fEnableInstantX = GetBoolArg("-enableinstantx", true);
if(fEnableInstantX){ if(fEnableInstantX){
nInstantXDepth = GetArg("-instantxdepth", 1); nInstantXDepth = GetArg("-instantxdepth", 5);
if(nInstantXDepth > 60) nInstantXDepth = 60; if(nInstantXDepth > 60) nInstantXDepth = 60;
if(nInstantXDepth < 0) nAnonymizeDarkcoinAmount = 0; if(nInstantXDepth < 0) nAnonymizeDarkcoinAmount = 0;
} else { } else {

View File

@ -18,10 +18,9 @@
using namespace std; using namespace std;
using namespace boost; using namespace boost;
std::vector<CTransactionLock> vecTxLocks;
std::map<uint256, CTransaction> mapTxLockReq; std::map<uint256, CTransaction> mapTxLockReq;
std::map<uint256, CTransaction> mapTxLockReqRejected; std::map<uint256, CTransaction> mapTxLockReqRejected;
std::map<uint256, int> mapTxLockVote;
std::map<uint256, CTransactionLock> mapTxLocks; std::map<uint256, CTransactionLock> mapTxLocks;
#define INSTANTX_SIGNATURES_REQUIRED 2 #define INSTANTX_SIGNATURES_REQUIRED 2
@ -51,15 +50,15 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
} }
int nTxAge = GetInputAge(tx.vin[0]); int nTxAge = GetInputAge(tx.vin[0]);
if(nTxAge < 5){ if(nTxAge <= 0){
LogPrintf("ProcessMessageInstantX::txlreq - Transaction not found / too new: %s\n", tx.GetHash().ToString().c_str()); LogPrintf("ProcessMessageInstantX::txlreq - Transaction not found / too new: %d / %s\n", nTxAge, tx.GetHash().ToString().c_str());
return; return;
} }
int nBlockHeight = chainActive.Tip()->nHeight - nTxAge; //calculate the height int nBlockHeight = chainActive.Tip()->nHeight - nTxAge; //calculate the height
BOOST_FOREACH(const CTxOut o, tx.vout){ BOOST_FOREACH(const CTxOut o, tx.vout){
if(!o.scriptPubKey.IsNormalPaymentScript()){ if(!o.scriptPubKey.IsNormalPaymentScript()){
LogPrintf ("ProcessMessageInstantX::txlreq - Invalid Script %s\n", tx.ToString().c_str()); printf ("ProcessMessageInstantX::txlreq - Invalid Script %s\n", tx.ToString().c_str());
return; return;
} }
} }
@ -104,133 +103,35 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
CConsensusVote ctx; CConsensusVote ctx;
vRecv >> ctx; vRecv >> ctx;
ProcessConsensusVote(ctx); CInv inv(MSG_TXLOCK_VOTE, ctx.GetHash());
return;
}
else if (strCommand == "txlock") //InstantX Lock Transaction Inputs
{
LogPrintf("ProcessMessageInstantX::txlock\n");
CDataStream vMsg(vRecv);
CTransactionLock ctxl;
vRecv >> ctxl;
CInv inv(MSG_TXLOCK, ctxl.GetHash());
pfrom->AddInventoryKnown(inv); pfrom->AddInventoryKnown(inv);
LogPrintf(" -- ProcessMessageInstantX::txlock %d %s\n", mapTxLocks.count(inv.hash), inv.hash.ToString().c_str()); if(mapTxLockVote.count(inv.hash)){
return;
if(!mapTxLocks.count(inv.hash)){
if(ctxl.CountSignatures() < INSTANTX_SIGNATURES_REQUIRED){
LogPrintf("InstantX::txlock - not enough signatures\n");
return;
}
if(!ctxl.SignaturesValid()){
LogPrintf("InstantX::txlock - got invalid TransactionLock, rejected\n");
return;
}
if(!ctxl.AllInFavor()){
LogPrintf("InstantX::txlock - not all in favor of lock, rejected\n");
return;
}
BOOST_FOREACH(const CTxOut o, ctxl.tx.vout){
if(!o.scriptPubKey.IsNormalPaymentScript()){
LogPrintf ("ProcessMessageInstantX::cxlock - Invalid Script %s\n", ctxl.tx.ToString().c_str());
return;
}
}
mapTxLocks.insert(make_pair(inv.hash, ctxl));
//we should have the lock request in place
if(!mapTxLockReq.count(inv.hash)){
//if we don't
bool fMissingInputs = false;
CValidationState state;
if (AcceptToMemoryPool(mempool, state, ctxl.tx, true, &fMissingInputs))
{
mapTxLockReq.insert(make_pair(inv.hash, ctxl.tx));
LogPrintf("ProcessMessageInstantX::txlock - Transaction Lock Request: %s %s : accepted (no reversing) %s\n",
pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str(),
ctxl.tx.GetHash().ToString().c_str()
);
} else {
// we have a conflicting transaction (an attack)
CValidationState state;
DisconnectBlockAndInputs(state, ctxl.tx);
if (AcceptToMemoryPool(mempool, state, ctxl.tx, true, &fMissingInputs))
{
mapTxLockReq.insert(make_pair(inv.hash, ctxl.tx));
LogPrintf("ProcessMessageInstantX::txlock - Transaction Lock Request: %s %s : accepted (reversed) %s\n",
pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str(),
ctxl.tx.GetHash().ToString().c_str()
);
} else {
LogPrintf("ProcessMessageInstantX::txlock - Transaction Lock Request: %s %s : rejected (reversed) %s\n",
pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str(),
ctxl.tx.GetHash().ToString().c_str()
);
}
}
}
//broadcast the new lock
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
if(!pnode->fRelayTxes)
continue;
pnode->PushMessage("txlock", ctxl);
}
pwalletMain->UpdatedTransaction(ctxl.GetHash());
LogPrintf("InstantX :: Got Transaction Lock: %s %s : accepted %s\n",
pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str(),
ctxl.GetHash().ToString().c_str()
);
} }
mapTxLockVote.insert(make_pair(inv.hash, 1));
ProcessConsensusVote(ctx);
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
pnode->PushMessage("txlvote", ctx);
}
return;
} }
} }
// check if we need to vote on this transaction // check if we need to vote on this transaction
void DoConsensusVote(CTransaction& tx, bool approved, int64_t nBlockHeight) void DoConsensusVote(CTransaction& tx, bool approved, int64_t nBlockHeight)
{ {
if(!fMasterNode) { if(!fMasterNode) return;
LogPrintf("InstantX::DoConsensusVote - Not masternode\n");
return;
}
int winner = GetCurrentMasterNode(1, nBlockHeight);
int n = GetMasternodeRank(activeMasternode.vin, nBlockHeight, MIN_INSTANTX_PROTO_VERSION);
if(n == -1 || winner == -1)
{
LogPrintf("InstantX::DoConsensusVote - Unknown Masternode\n");
return;
}
if(n == 1)
{ // winner, I'll be keeping track of this
LogPrintf("InstantX::DoConsensusVote - Managing Masternode\n");
CTransactionLock newLock;
newLock.nBlockHeight = nBlockHeight;
newLock.tx = tx;
vecTxLocks.push_back(newLock);
}
CConsensusVote ctx; CConsensusVote ctx;
ctx.vinMasternode = activeMasternode.vin; ctx.vinMasternode = activeMasternode.vin;
ctx.approved = approved; ctx.approved = approved;
ctx.txHash = tx.GetHash(); ctx.tx = tx;
ctx.nBlockHeight = nBlockHeight; ctx.nBlockHeight = nBlockHeight;
if(!ctx.Sign()){ if(!ctx.Sign()){
LogPrintf("InstantX::DoConsensusVote - Failed to sign consensus vote\n"); LogPrintf("InstantX::DoConsensusVote - Failed to sign consensus vote\n");
@ -241,47 +142,18 @@ void DoConsensusVote(CTransaction& tx, bool approved, int64_t nBlockHeight)
return; return;
} }
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
//LogPrintf("%s::check -- %s %s\n", vecMasternodes[winner].addr.ToString().c_str(), pnode->addr.ToString().c_str());
if(n == 1){ //I'm the winner pnode->PushMessage("txlvote", ctx);
ProcessConsensusVote(ctx);
} else if(n <= 10){ // not winner, but in the top10
if(ConnectNode((CAddress)vecMasternodes[winner].addr, NULL, true)){
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
if(vecMasternodes[winner].addr != pnode->addr) continue;
pnode->PushMessage("txlvote", ctx);
LogPrintf("InstantX::DoConsensusVote --- connected, sending vote %s\n", pnode->addr.ToString().c_str());
return;
}
} else {
LogPrintf("InstantX::DoConsensusVote --- error connecting \n");
return;
}
} }
} }
//received a consensus vote //received a consensus vote
void ProcessConsensusVote(CConsensusVote& ctx) void ProcessConsensusVote(CConsensusVote& ctx)
{ {
if(!fMasterNode) {
LogPrintf("InstantX::ProcessConsensusVote - Not masternode\n");
return;
}
int winner = GetCurrentMasterNode(1, ctx.nBlockHeight);
if(winner == -1) {
LogPrintf("InstantX::ProcessConsensusVote - Can't detect winning masternode\n");
return;
}
//We're not the winning masternode
if(vecMasternodes[winner].vin != activeMasternode.vin) {
LogPrintf("InstantX::ProcessConsensusVote - I'm not the winning masternode\n");
return;
}
int n = GetMasternodeRank(ctx.vinMasternode, ctx.nBlockHeight, MIN_INSTANTX_PROTO_VERSION); int n = GetMasternodeRank(ctx.vinMasternode, ctx.nBlockHeight, MIN_INSTANTX_PROTO_VERSION);
if(n == -1) if(n == -1)
@ -302,26 +174,25 @@ void ProcessConsensusVote(CConsensusVote& ctx)
return; return;
} }
//compile consessus vote std::map<uint256, CTransactionLock>::iterator a = mapTxLocks.find(ctx.tx.GetHash());
BOOST_FOREACH(CTransactionLock& ctxl, vecTxLocks){ if (a == mapTxLocks.end()){
if(ctxl.nBlockHeight == ctx.nBlockHeight){ CTransactionLock newLock;
ctxl.AddSignature(ctx); newLock.nBlockHeight = ctx.nBlockHeight;
if(ctxl.CountSignatures() >= INSTANTX_SIGNATURES_REQUIRED){ newLock.tx = ctx.tx;
LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Is Complete, broadcasting!\n"); mapTxLocks.insert(make_pair(ctx.tx.GetHash(), newLock));
CInv inv(MSG_TXLOCK, ctxl.GetHash());
mapTxLocks.insert(make_pair(inv.hash, ctxl));
//broadcast the new lock
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes){
pnode->PushMessage("txlock", ctxl);
}
}
return;
}
} }
//compile consessus vote
std::map<uint256, CTransactionLock>::iterator i = mapTxLocks.find(ctx.tx.GetHash());
if (i != mapTxLocks.end()){
(*i).second.AddSignature(ctx);
if((*i).second.CountSignatures() >= INSTANTX_SIGNATURES_REQUIRED){
LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Is Complete, broadcasting!\n");
}
return;
}
return; return;
} }
@ -342,11 +213,23 @@ void CleanTransactionLocksList()
} }
uint256 CConsensusVote::GetHash() const
{
std::string str = tx.GetHash().ToString().c_str();
str += vinMasternode.ToString().c_str();
str += boost::lexical_cast<std::string>(nBlockHeight);
str += boost::lexical_cast<std::string>(approved);
return Hash(BEGIN(str), END(str));
}
bool CConsensusVote::SignatureValid() bool CConsensusVote::SignatureValid()
{ {
std::string errorMessage; std::string errorMessage;
std::string strMessage = txHash.ToString().c_str() + boost::lexical_cast<std::string>(nBlockHeight) + boost::lexical_cast<std::string>(approved); std::string strMessage = tx.GetHash().ToString().c_str() + boost::lexical_cast<std::string>(nBlockHeight) + boost::lexical_cast<std::string>(approved);
LogPrintf("verify strMessage %s \n", strMessage.c_str()); //LogPrintf("verify strMessage %s \n", strMessage.c_str());
int n = GetMasternodeByVin(vinMasternode); int n = GetMasternodeByVin(vinMasternode);
@ -356,16 +239,16 @@ bool CConsensusVote::SignatureValid()
return false; return false;
} }
LogPrintf("verify addr %s \n", vecMasternodes[0].addr.ToString().c_str()); //LogPrintf("verify addr %s \n", vecMasternodes[0].addr.ToString().c_str());
LogPrintf("verify addr %s \n", vecMasternodes[1].addr.ToString().c_str()); //LogPrintf("verify addr %s \n", vecMasternodes[1].addr.ToString().c_str());
LogPrintf("verify addr %d %s \n", n, vecMasternodes[n].addr.ToString().c_str()); //LogPrintf("verify addr %d %s \n", n, vecMasternodes[n].addr.ToString().c_str());
CScript pubkey; CScript pubkey;
pubkey.SetDestination(vecMasternodes[n].pubkey2.GetID()); pubkey.SetDestination(vecMasternodes[n].pubkey2.GetID());
CTxDestination address1; CTxDestination address1;
ExtractDestination(pubkey, address1); ExtractDestination(pubkey, address1);
CBitcoinAddress address2(address1); CBitcoinAddress address2(address1);
LogPrintf("verify pubkey2 %s \n", address2.ToString().c_str()); //LogPrintf("verify pubkey2 %s \n", address2.ToString().c_str());
if(!darkSendSigner.VerifyMessage(vecMasternodes[n].pubkey2, vchMasterNodeSignature, strMessage, errorMessage)) { if(!darkSendSigner.VerifyMessage(vecMasternodes[n].pubkey2, vchMasterNodeSignature, strMessage, errorMessage)) {
LogPrintf("InstantX::CConsensusVote::SignatureValid() - Verify message failed\n"); LogPrintf("InstantX::CConsensusVote::SignatureValid() - Verify message failed\n");
@ -381,9 +264,9 @@ bool CConsensusVote::Sign()
CKey key2; CKey key2;
CPubKey pubkey2; CPubKey pubkey2;
std::string strMessage = txHash.ToString().c_str() + boost::lexical_cast<std::string>(nBlockHeight) + boost::lexical_cast<std::string>(approved); std::string strMessage = tx.GetHash().ToString().c_str() + boost::lexical_cast<std::string>(nBlockHeight) + boost::lexical_cast<std::string>(approved);
LogPrintf("signing strMessage %s \n", strMessage.c_str()); //LogPrintf("signing strMessage %s \n", strMessage.c_str());
LogPrintf("signing privkey %s \n", strMasterNodePrivKey.c_str()); //LogPrintf("signing privkey %s \n", strMasterNodePrivKey.c_str());
if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, key2, pubkey2)) if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, key2, pubkey2))
{ {
@ -396,7 +279,7 @@ bool CConsensusVote::Sign()
CTxDestination address1; CTxDestination address1;
ExtractDestination(pubkey, address1); ExtractDestination(pubkey, address1);
CBitcoinAddress address2(address1); CBitcoinAddress address2(address1);
LogPrintf("signing pubkey2 %s \n", address2.ToString().c_str()); //LogPrintf("signing pubkey2 %s \n", address2.ToString().c_str());
if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchMasterNodeSignature, key2)) { if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchMasterNodeSignature, key2)) {
LogPrintf("CActiveMasternode::RegisterAsMasterNode() - Sign message failed"); LogPrintf("CActiveMasternode::RegisterAsMasterNode() - Sign message failed");

View File

@ -44,16 +44,18 @@ class CConsensusVote
public: public:
CTxIn vinMasternode; CTxIn vinMasternode;
bool approved; bool approved;
uint256 txHash; CTransaction tx;
std::vector<unsigned char> vchMasterNodeSignature;
int nBlockHeight; int nBlockHeight;
std::vector<unsigned char> vchMasterNodeSignature;
uint256 GetHash() const;
bool SignatureValid(); bool SignatureValid();
bool Sign(); bool Sign();
IMPLEMENT_SERIALIZE IMPLEMENT_SERIALIZE
( (
READWRITE(txHash); READWRITE(tx);
READWRITE(vinMasternode); READWRITE(vinMasternode);
READWRITE(approved); READWRITE(approved);
READWRITE(vchMasterNodeSignature); READWRITE(vchMasterNodeSignature);

View File

@ -1156,6 +1156,29 @@ int CMerkleTx::GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const
return chainActive.Height() - pindex->nHeight + 1; return chainActive.Height() - pindex->nHeight + 1;
} }
int CMerkleTx::IsTransactionLocked() const
{
if(nInstantXDepth == 0) return 0;
//printf("mapTxLocks start\n");
typedef std::map<uint256, CTransactionLock>::iterator it_ctxl;
int found = 0;
for (unsigned int b = 0; b < vout.size(); b++) {
for(it_ctxl it = mapTxLocks.begin(); it != mapTxLocks.end(); it++) {
for (unsigned int a = 0; a < it->second.tx.vout.size(); a++) {
if(vout[b] == it->second.tx.vout[a])
found++;
}
if(found > 0) break;
}
}
//printf("mapTxLocks end %d %d\n", found , (int)vout.size());
if(found == (int)vout.size()) return nInstantXDepth;
return 0;
}
int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const
{ {
AssertLockHeld(cs_main); AssertLockHeld(cs_main);
@ -1163,6 +1186,11 @@ int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const
if (nResult == 0 && !mempool.exists(GetHash())) if (nResult == 0 && !mempool.exists(GetHash()))
return -1; // Not in chain, not in mempool return -1; // Not in chain, not in mempool
if (nResult < 6){
int minConfirms = IsTransactionLocked();
return minConfirms+nResult;
}
return nResult; return nResult;
} }

View File

@ -485,6 +485,7 @@ public:
bool IsInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; } bool IsInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
int GetBlocksToMaturity() const; int GetBlocksToMaturity() const;
bool AcceptToMemoryPool(bool fLimitFree=true); bool AcceptToMemoryPool(bool fLimitFree=true);
int IsTransactionLocked() const;
}; };

View File

@ -26,7 +26,7 @@ void ProcessMasternodeConnections(){
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
{ {
//if it's our masternode, let it be //if it's our masternode, let it be
if((CNetAddr)darkSendPool.submittedToMasternode == (CNetAddr)pnode->addr) continue; if(darkSendPool.submittedToMasternode == pnode->addr) continue;
if(pnode->fDarkSendMaster){ if(pnode->fDarkSendMaster){
LogPrintf("Closing masternode connection %s \n", pnode->addr.ToString().c_str()); LogPrintf("Closing masternode connection %s \n", pnode->addr.ToString().c_str());
@ -101,11 +101,6 @@ void ProcessMessageMasternode(CNode* pfrom, std::string& strCommand, CDataStream
return; return;
} }
if(
(Params().NetworkID() == CChainParams::TESTNET && addr.GetPort() != 19999) ||
(Params().NetworkID() == CChainParams::REGTEST && addr.GetPort() != 19999) ||
(Params().NetworkID() == CChainParams::MAIN && addr.GetPort() != 9999)) return;
//search existing masternode list, this is where we update existing masternodes with new dsee broadcasts //search existing masternode list, this is where we update existing masternodes with new dsee broadcasts
BOOST_FOREACH(CMasterNode& mn, vecMasternodes) { BOOST_FOREACH(CMasterNode& mn, vecMasternodes) {
@ -269,7 +264,7 @@ void ProcessMessageMasternode(CNode* pfrom, std::string& strCommand, CDataStream
if(vin == CTxIn()) { //only should ask for this once if(vin == CTxIn()) { //only should ask for this once
//local network //local network
if(!pfrom->addr.IsRFC1918()) if(!pfrom->addr.IsRFC1918() && Params().NetworkID() == CChainParams::MAIN)
{ {
std::map<CNetAddr, int64_t>::iterator i = askedForMasternodeList.find(pfrom->addr); std::map<CNetAddr, int64_t>::iterator i = askedForMasternodeList.find(pfrom->addr);
if (i != askedForMasternodeList.end()) if (i != askedForMasternodeList.end())

View File

@ -29,11 +29,11 @@ bool CMasternodeConfig::read(std::string& strErr) {
return false; return false;
} }
if(CService(ip).GetPort() != 19999 && CService(ip).GetPort() != 9999) { /* if(CService(ip).GetPort() != 19999 && CService(ip).GetPort() != 9999) {
strErr = "Invalid port (must be 9999 for mainnet or 19999 for testnet) detected in masternode.conf: " + line; strErr = "Invalid port (must be 9999 for mainnet or 19999 for testnet) detected in masternode.conf: " + line;
streamConfig.close(); streamConfig.close();
return false; return false;
} }*/
add(alias, ip, privKey, txHash, outputIndex); add(alias, ip, privKey, txHash, outputIndex);
} }

View File

@ -435,7 +435,7 @@ CNode* FindNode(const CService& addr)
{ {
LOCK(cs_vNodes); LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
if((CNetAddr)pnode->addr == (CNetAddr)addr) if(pnode->addr == addr)
return (pnode); return (pnode);
return NULL; return NULL;
} }

View File

@ -136,7 +136,7 @@ enum
// MSG_FILTERED_BLOCK should not appear in any invs except as a part of getdata. // MSG_FILTERED_BLOCK should not appear in any invs except as a part of getdata.
MSG_FILTERED_BLOCK, MSG_FILTERED_BLOCK,
MSG_TXLOCK_REQUEST, MSG_TXLOCK_REQUEST,
MSG_TXLOCK, MSG_TXLOCK_VOTE,
}; };
#endif // __INCLUDED_PROTOCOL_H__ #endif // __INCLUDED_PROTOCOL_H__

View File

@ -173,16 +173,7 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayoutCoinControl5"> <layout class="QHBoxLayout" name="horizontalLayoutCoinControl5">
<property name="leftMargin"> <property name="margin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -614,20 +605,11 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>830</width> <width>830</width>
<height>178</height> <height>149</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1"> <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
<property name="leftMargin"> <property name="margin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -766,7 +748,7 @@
<item> <item>
<widget class="QCheckBox" name="checkInstantX"> <widget class="QCheckBox" name="checkInstantX">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>InstantX</string> <string>InstantX</string>

View File

@ -128,6 +128,7 @@ OverviewPage::OverviewPage(QWidget *parent) :
showingDarkSendMessage = 0; showingDarkSendMessage = 0;
darksendActionCheck = 0; darksendActionCheck = 0;
lastNewBlock = 0;
if(fLiteMode){ if(fLiteMode){
ui->frameDarksend->setVisible(false); ui->frameDarksend->setVisible(false);
@ -308,6 +309,10 @@ void OverviewPage::darkSendStatus()
if(nBestHeight != darkSendPool.cachedNumBlocks) if(nBestHeight != darkSendPool.cachedNumBlocks)
{ {
//we we're processing lots of blocks, we'll just leave
if(GetTime() - lastNewBlock < 10) return;
lastNewBlock = GetTime();
updateDarksendProgress(); updateDarksendProgress();
QString strSettings(" Rounds"); QString strSettings(" Rounds");

View File

@ -50,6 +50,7 @@ private:
qint64 currentUnconfirmedBalance; qint64 currentUnconfirmedBalance;
qint64 currentImmatureBalance; qint64 currentImmatureBalance;
qint64 currentAnonymizedBalance; qint64 currentAnonymizedBalance;
qint64 lastNewBlock;
int showingDarkSendMessage; int showingDarkSendMessage;
int darksendActionCheck; int darksendActionCheck;

View File

@ -31,15 +31,28 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
} }
else else
{ {
int nDepth = wtx.GetDepthInMainChain(); QString strUsingIX = "";
if (nDepth < 0) if(wtx.IsTransactionLocked()){
return tr("conflicted"); int nDepth = wtx.GetDepthInMainChain();
else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0) if (nDepth < 0)
return tr("%1/offline").arg(nDepth); return tr("conflicted");
else if (nDepth < 6) else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
return tr("%1/unconfirmed").arg(nDepth); return tr("%1/offline (instantx)").arg(nDepth);
else else if (nDepth < 6)
return tr("%1 confirmations").arg(nDepth); return tr("%1/instantx").arg(nDepth);
else
return tr("%1 confirmations (instantx)").arg(nDepth);
} 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").arg(nDepth);
else if (nDepth < 6)
return tr("%1/unconfirmed").arg(nDepth);
else
return tr("%1 confirmations").arg(nDepth);
}
} }
} }