mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 05:23:01 +01:00
cleared up masternode status messages
This commit is contained in:
parent
18ed69d504
commit
d6816f09bc
@ -192,7 +192,7 @@ void CDarkSendPool::Check()
|
|||||||
LogPrintf("CDarkSendPool::Check() -- COMPLETED -- RESETTING \n");
|
LogPrintf("CDarkSendPool::Check() -- COMPLETED -- RESETTING \n");
|
||||||
SetNull(true);
|
SetNull(true);
|
||||||
UnlockCoins();
|
UnlockCoins();
|
||||||
if(fMasterNode) RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1);
|
if(fMasterNode) RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_RESET);
|
||||||
pwalletMain->Lock();
|
pwalletMain->Lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ void CDarkSendPool::Check()
|
|||||||
if((state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) && GetTimeMillis()-lastTimeChanged >= 10000) {
|
if((state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) && GetTimeMillis()-lastTimeChanged >= 10000) {
|
||||||
LogPrintf("CDarkSendPool::Check() -- RESETTING MESSAGE \n");
|
LogPrintf("CDarkSendPool::Check() -- RESETTING MESSAGE \n");
|
||||||
SetNull(true);
|
SetNull(true);
|
||||||
if(fMasterNode) RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1);
|
if(fMasterNode) RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_RESET);
|
||||||
UnlockCoins();
|
UnlockCoins();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ void CDarkSendPool::CheckTimeout(){
|
|||||||
UnlockCoins();
|
UnlockCoins();
|
||||||
}
|
}
|
||||||
if(fMasterNode){
|
if(fMasterNode){
|
||||||
RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1);
|
RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_RESET);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -580,6 +580,10 @@ void CDarkSendPool::SendDarksendDenominate(const CTransaction& collateral, std::
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Incoming message from masternode updating the progress of darksend
|
// Incoming message from masternode updating the progress of darksend
|
||||||
|
// newAccepted: -1 mean's it'n not a "transaction accepted/not accepted" message, just a standard update
|
||||||
|
// 0 means transaction was not accepted
|
||||||
|
// 1 means transaction was accepted
|
||||||
|
|
||||||
bool CDarkSendPool::StatusUpdate(int newState, int newEntriesCount, int newAccepted, std::string& error, int newSessionID){
|
bool CDarkSendPool::StatusUpdate(int newState, int newEntriesCount, int newAccepted, std::string& error, int newSessionID){
|
||||||
if(fMasterNode) return false;
|
if(fMasterNode) return false;
|
||||||
if(state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) return false;
|
if(state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) return false;
|
||||||
|
@ -362,7 +362,7 @@ public:
|
|||||||
if(state != newState){
|
if(state != newState){
|
||||||
lastTimeChanged = GetTimeMillis();
|
lastTimeChanged = GetTimeMillis();
|
||||||
if(fMasterNode) {
|
if(fMasterNode) {
|
||||||
RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1);
|
RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_RESET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state = newState;
|
state = newState;
|
||||||
|
35
src/main.cpp
35
src/main.cpp
@ -3916,13 +3916,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
if(!darkSendPool.IsCompatibleWithSession(nAmount, error))
|
if(!darkSendPool.IsCompatibleWithSession(nAmount, error))
|
||||||
{
|
{
|
||||||
LogPrintf("dsa -- not compatible with existing transactions! \n");
|
LogPrintf("dsa -- not compatible with existing transactions! \n");
|
||||||
accepted = 0;
|
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_REJECTED, error);
|
||||||
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted, error);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("dsa -- is compatible, please submit! \n");
|
LogPrintf("dsa -- is compatible, please submit! \n");
|
||||||
accepted = 1;
|
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_ACCEPTED, error);
|
||||||
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted, error);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (strCommand == "dsq") { //DarkSend Queue
|
} else if (strCommand == "dsq") { //DarkSend Queue
|
||||||
@ -3977,9 +3975,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
/* if(!darkSendPool.IsCompatibleWithEntries(out))
|
/* if(!darkSendPool.IsCompatibleWithEntries(out))
|
||||||
{
|
{
|
||||||
LogPrintf("dsi -- not compatible with existing transactions! \n");
|
LogPrintf("dsi -- not compatible with existing transactions! \n");
|
||||||
accepted = 0;
|
|
||||||
error = "not compatible with existing transactions";
|
error = "not compatible with existing transactions";
|
||||||
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted, error);
|
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_REJECTED, error);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4011,9 +4008,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
|
|
||||||
if(o.scriptPubKey.size() != 25){
|
if(o.scriptPubKey.size() != 25){
|
||||||
LogPrintf("dsi - non-standard pubkey detected! %s\n", o.scriptPubKey.ToString().c_str());
|
LogPrintf("dsi - non-standard pubkey detected! %s\n", o.scriptPubKey.ToString().c_str());
|
||||||
accepted = 0;
|
|
||||||
error = "non-standard pubkey detected";
|
error = "non-standard pubkey detected";
|
||||||
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted, error);
|
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_REJECTED, error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4043,45 +4039,40 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
LogPrintf("dsi -- fees %"PRI64d"-%"PRI64d"=%"PRI64d" \ntx:%s\n", nValueIn, nValueOut, nFees, tx.ToString().c_str());
|
LogPrintf("dsi -- fees %"PRI64d"-%"PRI64d"=%"PRI64d" \ntx:%s\n", nValueIn, nValueOut, nFees, tx.ToString().c_str());
|
||||||
if (nFees < txMinFee) {
|
if (nFees < txMinFee) {
|
||||||
LogPrintf("dsi -- fees are too low! %"PRI64d"-%"PRI64d"=%"PRI64d" \ntx:%s\n", nValueIn, nValueOut, nFees, tx.ToString().c_str());
|
LogPrintf("dsi -- fees are too low! %"PRI64d"-%"PRI64d"=%"PRI64d" \ntx:%s\n", nValueIn, nValueOut, nFees, tx.ToString().c_str());
|
||||||
accepted = 0;
|
|
||||||
error = "transaction fees are too low";
|
error = "transaction fees are too low";
|
||||||
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted, error);
|
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_REJECTED, error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nValueIn-nValueOut > nValueIn*.01) {
|
if (nValueIn-nValueOut > nValueIn*.01) {
|
||||||
LogPrintf("dsi -- fees are too high! %s\n", tx.ToString().c_str());
|
LogPrintf("dsi -- fees are too high! %s\n", tx.ToString().c_str());
|
||||||
accepted = 0;
|
|
||||||
error = "transaction fees are too high";
|
error = "transaction fees are too high";
|
||||||
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted, error);
|
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_REJECTED, error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("dsi -- missing input tx! %s\n", tx.ToString().c_str());
|
LogPrintf("dsi -- missing input tx! %s\n", tx.ToString().c_str());
|
||||||
accepted = 0;
|
|
||||||
error = "missing input tx information";
|
error = "missing input tx information";
|
||||||
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted, error);
|
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_REJECTED, error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
if (!tx.IsAcceptable(state, true, false, &missing, false)){ //AcceptableInputs(state, true)){
|
if (!tx.IsAcceptable(state, true, false, &missing, false)){ //AcceptableInputs(state, true)){
|
||||||
LogPrintf("dsi -- transactione not valid! \n");
|
LogPrintf("dsi -- transactione not valid! \n");
|
||||||
accepted = 0;
|
|
||||||
error = "transaction not valid";
|
error = "transaction not valid";
|
||||||
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted, error);
|
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_REJECTED, error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(darkSendPool.AddEntry(in, nAmount, txCollateral, out, error)){
|
if(darkSendPool.AddEntry(in, nAmount, txCollateral, out, error)){
|
||||||
accepted = 1;
|
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_ACCEPTED, error);
|
||||||
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted, error);
|
|
||||||
darkSendPool.Check();
|
darkSendPool.Check();
|
||||||
|
|
||||||
RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1);
|
RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_RESET);
|
||||||
} else {
|
} else {
|
||||||
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted, error);
|
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_REJECTED, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4093,7 +4084,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
if(!fMasterNode) return true;
|
if(!fMasterNode) return true;
|
||||||
|
|
||||||
std::string error = "";
|
std::string error = "";
|
||||||
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1, error);
|
pfrom->PushMessage("dssu", darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_RESET, error);
|
||||||
//pfrom->fDisconnect = true;
|
//pfrom->fDisconnect = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -4148,7 +4139,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
|
|
||||||
if(success){
|
if(success){
|
||||||
darkSendPool.Check();
|
darkSendPool.Check();
|
||||||
RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1);
|
RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,11 @@
|
|||||||
#define MASTERNODE_EXPIRATION_MICROSECONDS 35*60*1000*1000
|
#define MASTERNODE_EXPIRATION_MICROSECONDS 35*60*1000*1000
|
||||||
#define MASTERNODE_REMOVAL_MICROSECONDS 35.5*60*1000*1000
|
#define MASTERNODE_REMOVAL_MICROSECONDS 35.5*60*1000*1000
|
||||||
|
|
||||||
|
// status update message constants
|
||||||
|
#define MASTERNODE_ACCEPTED 1
|
||||||
|
#define MASTERNODE_REJECTED 0
|
||||||
|
#define MASTERNODE_RESET -1
|
||||||
|
|
||||||
class CWallet;
|
class CWallet;
|
||||||
class CBlock;
|
class CBlock;
|
||||||
class CBlockIndex;
|
class CBlockIndex;
|
||||||
|
Loading…
Reference in New Issue
Block a user