mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge branch 'mnchanges'
This commit is contained in:
commit
d1669b87d2
@ -3,7 +3,7 @@ AC_PREREQ([2.60])
|
||||
define(_CLIENT_VERSION_MAJOR, 0)
|
||||
define(_CLIENT_VERSION_MINOR, 11)
|
||||
define(_CLIENT_VERSION_REVISION, 0)
|
||||
define(_CLIENT_VERSION_BUILD, 8)
|
||||
define(_CLIENT_VERSION_BUILD, 9)
|
||||
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])
|
||||
|
@ -12,7 +12,7 @@
|
||||
#define CLIENT_VERSION_MAJOR 0
|
||||
#define CLIENT_VERSION_MINOR 11
|
||||
#define CLIENT_VERSION_REVISION 0
|
||||
#define CLIENT_VERSION_BUILD 8
|
||||
#define CLIENT_VERSION_BUILD 9
|
||||
|
||||
|
||||
|
||||
|
@ -91,6 +91,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
|
||||
}
|
||||
|
||||
else if (strCommand == "dsa") { //DarkSend Acceptable
|
||||
|
||||
if (pfrom->nVersion < darkSendPool.MIN_PEER_PROTO_VERSION) {
|
||||
std::string strError = "incompatible version";
|
||||
LogPrintf("dsa -- incompatible version! \n");
|
||||
@ -140,6 +141,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
|
||||
return;
|
||||
}
|
||||
} else if (strCommand == "dsq") { //DarkSend Queue
|
||||
|
||||
if (pfrom->nVersion < darkSendPool.MIN_PEER_PROTO_VERSION) {
|
||||
return;
|
||||
}
|
||||
@ -147,6 +149,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
|
||||
CDarksendQueue dsq;
|
||||
vRecv >> dsq;
|
||||
|
||||
|
||||
CService addr;
|
||||
if(!dsq.GetAddress(addr)) return;
|
||||
if(!dsq.CheckSignature()) return;
|
||||
@ -156,7 +159,6 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
|
||||
int mn = GetMasternodeByVin(dsq.vin);
|
||||
if(mn == -1) return;
|
||||
|
||||
|
||||
// if the queue is ready, submit if we can
|
||||
if(dsq.ready) {
|
||||
if((CNetAddr)darkSendPool.submittedToMasternode != (CNetAddr)addr){
|
||||
@ -324,6 +326,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
|
||||
}
|
||||
|
||||
else if (strCommand == "dssu") { //DarkSend status update
|
||||
|
||||
if (pfrom->nVersion < darkSendPool.MIN_PEER_PROTO_VERSION) {
|
||||
return;
|
||||
}
|
||||
@ -1527,6 +1530,9 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
|
||||
if(!dsq.GetProtocolVersion(protocolVersion)) continue;
|
||||
if(protocolVersion < MIN_PEER_PROTO_VERSION) continue;
|
||||
|
||||
//non-denom's are incompatible
|
||||
if((dsq.nDenom & (1 << 4))) continue;
|
||||
|
||||
//don't reuse masternodes
|
||||
BOOST_FOREACH(CTxIn usedVin, vecMasternodesUsed){
|
||||
if(dsq.vin == usedVin) {
|
||||
@ -1537,7 +1543,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
|
||||
// Try to match their denominations if possible
|
||||
if (!pwalletMain->SelectCoinsByDenominations(dsq.nDenom, nValueMin, balanceNeedsAnonymized, vCoins, nValueIn, 0, nDarksendRounds)){
|
||||
// if (!pwalletMain->SelectCoinsByDenominations(dsq.nDenom, nValueMin, balanceNeedsAnonymized, vCoins, nValueIn, -2, 0)){
|
||||
LogPrintf("DoAutomaticDenominating - Couldn't match denominations\n");
|
||||
LogPrintf("DoAutomaticDenominating - Couldn't match denominations %d\n", dsq.nDenom);
|
||||
continue;
|
||||
// }
|
||||
}
|
||||
@ -1545,6 +1551,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
|
||||
// connect to masternode and submit the queue request
|
||||
if(ConnectNode((CAddress)addr, NULL, true)){
|
||||
submittedToMasternode = addr;
|
||||
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
{
|
||||
@ -1602,10 +1609,11 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
|
||||
LogPrintf("DoAutomaticDenominating -- attempt %d connection to masternode %s\n", sessionTries, vecMasternodes[i].addr.ToString().c_str());
|
||||
if(ConnectNode((CAddress)vecMasternodes[i].addr, NULL, true)){
|
||||
submittedToMasternode = vecMasternodes[i].addr;
|
||||
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
{
|
||||
if((CNetAddr)pnode->addr != (CNetAddr)vecMasternodes[i].addr) continue;
|
||||
if((CNetAddr)pnode->addr != (CNetAddr)vecMasternodes[i].addr) continue;
|
||||
|
||||
std::string strReason;
|
||||
if(txCollateral == CTransaction()){
|
||||
@ -1947,6 +1955,7 @@ void CDarkSendPool::GetDenominationsToString(int nDenom, std::string& strDenom){
|
||||
// bit 1 - 10DRK+1
|
||||
// bit 2 - 1DRK+1
|
||||
// bit 3 - .1DRK+1
|
||||
// bit 3 - non-denom
|
||||
|
||||
|
||||
strDenom = "";
|
||||
@ -1970,7 +1979,6 @@ void CDarkSendPool::GetDenominationsToString(int nDenom, std::string& strDenom){
|
||||
if(strDenom.size() > 0) strDenom += "+";
|
||||
strDenom += "0.1";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// return a bitshifted integer representing the denominations in this list
|
||||
@ -2010,6 +2018,7 @@ int CDarkSendPool::GetDenominations(const std::vector<CTxOut>& vout){
|
||||
return denom;
|
||||
}
|
||||
|
||||
|
||||
int CDarkSendPool::GetDenominationsByAmounts(std::vector<int64_t>& vecAmount){
|
||||
CScript e = CScript();
|
||||
std::vector<CTxOut> vout1;
|
||||
|
@ -223,7 +223,7 @@ class CDarksendSession
|
||||
class CDarkSendPool
|
||||
{
|
||||
public:
|
||||
static const int MIN_PEER_PROTO_VERSION = 70052;
|
||||
static const int MIN_PEER_PROTO_VERSION = 70053;
|
||||
|
||||
// clients entries
|
||||
std::vector<CDarkSendEntry> myEntries;
|
||||
|
@ -344,29 +344,6 @@ void OverviewPage::darkSendStatus()
|
||||
// Balance and number of transactions might have changed
|
||||
darkSendPool.cachedNumBlocks = nBestHeight;
|
||||
|
||||
if (pwalletMain->GetBalance() - pwalletMain->GetAnonymizedBalance() > 2*COIN){
|
||||
if (walletModel->getEncryptionStatus() != WalletModel::Unencrypted){
|
||||
if((nAnonymizeDarkcoinAmount*COIN)-pwalletMain->GetAnonymizedBalance() > 1.1*COIN &&
|
||||
walletModel->getEncryptionStatus() == WalletModel::Locked){
|
||||
|
||||
WalletModel::UnlockContext ctx(walletModel->requestUnlock(false));
|
||||
if(!ctx.isValid()){
|
||||
//unlock was cancelled
|
||||
fEnableDarksend = false;
|
||||
darkSendPool.cachedNumBlocks = 0;
|
||||
LogPrintf("Wallet is locked and user declined to unlock. Disabling Darksend.\n");
|
||||
}
|
||||
}
|
||||
if((nAnonymizeDarkcoinAmount*COIN)-pwalletMain->GetAnonymizedBalance() <= 1.1*COIN &&
|
||||
walletModel->getEncryptionStatus() == WalletModel::Unlocked &&
|
||||
darkSendPool.GetMyTransactionCount() == 0){
|
||||
|
||||
LogPrintf("Darksend is complete, locking wallet.\n");
|
||||
walletModel->setWalletLocked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* *******************************************************/
|
||||
|
||||
ui->darksendEnabled->setText("Enabled");
|
||||
@ -472,6 +449,24 @@ void OverviewPage::toggleDarksend(){
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (pwalletMain->GetBalance() - pwalletMain->GetAnonymizedBalance() > 2*COIN){
|
||||
if (walletModel->getEncryptionStatus() != WalletModel::Unencrypted){
|
||||
if((nAnonymizeDarkcoinAmount*COIN)-pwalletMain->GetAnonymizedBalance() > 1.1*COIN &&
|
||||
walletModel->getEncryptionStatus() == WalletModel::Locked){
|
||||
|
||||
WalletModel::UnlockContext ctx(walletModel->requestUnlock(false));
|
||||
if(!ctx.isValid()){
|
||||
//unlock was cancelled
|
||||
fEnableDarksend = false;
|
||||
darkSendPool.cachedNumBlocks = 0;
|
||||
LogPrintf("Wallet is locked and user declined to unlock. Disabling Darksend.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
darkSendPool.cachedNumBlocks = 0;
|
||||
|
@ -27,7 +27,7 @@ extern const std::string CLIENT_DATE;
|
||||
// network protocol versioning
|
||||
//
|
||||
|
||||
static const int PROTOCOL_VERSION = 70052;
|
||||
static const int PROTOCOL_VERSION = 70053;
|
||||
|
||||
// intial proto version, to be increased after version/verack negotiation
|
||||
static const int INIT_PROTO_VERSION = 209;
|
||||
|
@ -1554,6 +1554,11 @@ bool CWallet::SelectCoinsByDenominations(int nDenom, int64_t nValueMin, int64_t
|
||||
if(rounds < nDarksendRoundsMin) continue;
|
||||
|
||||
if(fFound100 && fFound10 && fFound1 && fFoundDot1){ //if fulfilled
|
||||
//we can return this for submission
|
||||
if(nValueRet >= nValueMin){
|
||||
//random reduce the max amount we'll submit for anonymity
|
||||
nValueMax -= (rand() % (nValueMax/5));
|
||||
}
|
||||
//Denomination criterion has been met, we can take any matching denominations
|
||||
if((nDenom & (1 << 0)) && out.tx->vout[out.i].nValue == ((100*COIN)+1)) {fAccepted = true;}
|
||||
else if((nDenom & (1 << 1)) && out.tx->vout[out.i].nValue == ((10*COIN)+1)) {fAccepted = true;}
|
||||
|
Loading…
Reference in New Issue
Block a user