fixed finalized error

This commit is contained in:
Evan Duffield 2014-08-05 09:17:24 -07:00
parent 960ca2db39
commit b770f344b6
3 changed files with 36 additions and 11 deletions

View File

@ -9,7 +9,7 @@
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 10
#define CLIENT_VERSION_REVISION 12
#define CLIENT_VERSION_BUILD 13
#define CLIENT_VERSION_BUILD 14
// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true

View File

@ -3906,7 +3906,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
int i = darkSendPool.GetCurrentMasterNode(1);
if(i < 0) return false;
if(darkSendMasterNodes[i].addr != pfrom->addr){
printf("dsc - message doesn't match current masternode\n");
printf("dsc - message doesn't match current masternode - %s != %s\n", darkSendMasterNodes[i].addr.ToString().c_str(), pfrom->addr.ToString().c_str());
return false;
}
@ -4039,7 +4039,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
int i = darkSendPool.GetCurrentMasterNode(1);
if(i < 0) return false;
if(darkSendMasterNodes[i].addr != pfrom->addr){
printf("dssu - message doesn't match current masternode\n");
printf("dssu - message doesn't match current masternode - %s != %s\n", darkSendMasterNodes[i].addr.ToString().c_str(), pfrom->addr.ToString().c_str());
return false;
}
@ -5995,7 +5995,7 @@ void CDarkSendPool::Check()
}
// better way to do this?
if(state == POOL_STATUS_FINALIZE_TRANSACTION && finalTransaction == CTransaction()) {
if(state == POOL_STATUS_FINALIZE_TRANSACTION && finalTransaction.vin.empty() && finalTransaction.vout.empty()) {
if(fDebug) printf("CDarkSendPool::Check() -- FINALIZE TRANSACTIONS\n");
UpdateState(POOL_STATUS_SIGNING);
@ -6351,7 +6351,7 @@ void CDarkSendPool::SendMoney(const CTransaction& collateral, std::vector<CTxIn>
printf("CDarkSendPool::SendMoney() -- NEW INPUT -- adding %s\n", vin[0].ToString().c_str());
}
if(state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) ClearLastMessage();
ClearLastMessage();
printf("CDarkSendPool::SendMoney() - Is connected to masternode?.\n");
@ -6466,17 +6466,23 @@ bool CDarkSendPool::SignFinalTransaction(CTransaction& finalTransactionNew, CNod
return true;
}
bool CDarkSendPool::IsConnectedToMasterNode(){
bool connected = false;
LOCK(cs_vNodes);
int i = darkSendPool.GetCurrentMasterNode(1);
if(i < 0) return false;
BOOST_FOREACH(CNode* pnode, vNodes)
{
if(!pnode->fDarkSendMaster)
continue;
if(darkSendMasterNodes[i].addr == pnode->addr)
return true;
connected = true;
if(pnode->fDarkSendMaster)
pnode->CloseSocketDisconnect();
}
return connected;
return false;
}
void CDarkSendPool::DisconnectMasterNode(){

View File

@ -87,7 +87,7 @@ Value masternode(const Array& params, bool fHelp)
if (fHelp ||
(strCommand != "start" && strCommand != "stop" && strCommand != "list" && strCommand != "count" && strCommand != "enforce"
&& strCommand != "debug" && strCommand != "create" && strCommand != "current" && strCommand != "votes" && strCommand != "genkey"))
&& strCommand != "debug" && strCommand != "create" && strCommand != "current" && strCommand != "votes" && strCommand != "genkey" && strCommand != "connect"))
throw runtime_error(
"masternode <start|stop|list|count|debug|create|current|votes|genkey|enforce> passphrase\n");
@ -250,6 +250,25 @@ Value masternode(const Array& params, bool fHelp)
return (uint64_t)enforceMasternodePaymentsTime;
}
if(strCommand == "connect")
{
std::string strAddress = "";
if (params.size() == 2){
strAddress = params[1].get_str().c_str();
} else {
throw runtime_error(
"Masternode address required\n");
}
CService addr = CService(strAddress);
if(ConnectNode((CAddress)addr, NULL, true)){
return "successfully connected";
} else {
return "error connecting";
}
}
return Value::null;
}