bool CActiveMasternode::Dseep(std::string& errorMessage) { if(status != MASTERNODE_IS_CAPABLE && status != MASTERNODE_REMOTELY_ENABLED) { errorMessage = "masternode is not in a running status"; LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", errorMessage.c_str()); return false; } CPubKey pubKeyMasternode; CKey keyMasternode; if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, keyMasternode, pubKeyMasternode)) { LogPrintf("Register::ManageStatus() - Error upon calling SetKey: %s\n", errorMessage.c_str()); return false; } return Dseep(vin, service, keyMasternode, pubKeyMasternode, errorMessage, false); }
bool CActiveThrone::Dseep(std::string& errorMessage) { if(status != THRONE_IS_CAPABLE && status != THRONE_REMOTELY_ENABLED) { errorMessage = "Throne is not in a running status"; LogPrintf("CActiveThrone::Dseep() - Error: %s\n", errorMessage.c_str()); return false; } CPubKey pubKeyThrone; CKey keyThrone; if(!darkSendSigner.SetKey(strThroNePrivKey, errorMessage, keyThrone, pubKeyThrone)) { LogPrintf("CActiveThrone::Dseep() - Error upon calling SetKey: %s\n", errorMessage.c_str()); return false; } return Dseep(vin, service, keyThrone, pubKeyThrone, errorMessage, false); }
// Send stop dseep to network for any masternode bool CActiveMasternode::StopMasterNode(CTxIn vin, CService service, CKey keyMasternode, CPubKey pubKeyMasternode, std::string& errorMessage) { pwalletMain->UnlockCoin(vin.prevout); return Dseep(vin, service, keyMasternode, pubKeyMasternode, errorMessage, true); }
// // Bootup the masternode, look for a 1000 NODX input and register on the network // void CActiveMasternode::ManageStatus() { std::string errorMessage; if(!fMasterNode) return; if (fDebug) LogPrintf("CActiveMasternode::ManageStatus() - Begin\n"); //need correct adjusted time to send ping bool fIsInitialDownload = IsInitialBlockDownload(); if(fIsInitialDownload) { status = MASTERNODE_SYNC_IN_PROCESS; LogPrintf("CActiveMasternode::ManageStatus() - Sync in progress. Must wait until sync is complete to start masternode.\n"); return; } if(status == MASTERNODE_INPUT_TOO_NEW || status == MASTERNODE_NOT_CAPABLE || status == MASTERNODE_SYNC_IN_PROCESS){ status = MASTERNODE_NOT_PROCESSED; } if(status == MASTERNODE_NOT_PROCESSED) { if(strMasterNodeAddr.empty()) { if(!GetLocal(service)) { notCapableReason = "Can't detect external address. Please use the masternodeaddr configuration option."; status = MASTERNODE_NOT_CAPABLE; LogPrintf("CActiveMasternode::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } } else { service = CService(strMasterNodeAddr); } LogPrintf("CActiveMasternode::ManageStatus() - Checking inbound connection to '%s'\n", service.ToString().c_str()); if(!ConnectNode((CAddress)service, service.ToString().c_str())){ notCapableReason = "Could not connect to " + service.ToString(); status = MASTERNODE_NOT_CAPABLE; LogPrintf("CActiveMasternode::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } if(pwalletMain->IsLocked()){ notCapableReason = "Wallet is locked."; status = MASTERNODE_NOT_CAPABLE; LogPrintf("CActiveMasternode::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } // Set defaults status = MASTERNODE_NOT_CAPABLE; notCapableReason = "Unknown. Check debug.log for more information.\n"; // Choose coins to use CPubKey pubKeyCollateralAddress; CKey keyCollateralAddress; if(GetMasterNodeVin(vin, pubKeyCollateralAddress, keyCollateralAddress)) { if(GetInputAge(vin) < MASTERNODE_MIN_CONFIRMATIONS){ LogPrintf("CActiveMasternode::ManageStatus() - Input must have least %d confirmations - %d confirmations\n", MASTERNODE_MIN_CONFIRMATIONS, GetInputAge(vin)); status = MASTERNODE_INPUT_TOO_NEW; return; } LogPrintf("CActiveMasternode::ManageStatus() - Is capable master node!\n"); status = MASTERNODE_IS_CAPABLE; notCapableReason = ""; pwalletMain->LockCoin(vin.prevout); // send to all nodes CPubKey pubKeyMasternode; CKey keyMasternode; if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, keyMasternode, pubKeyMasternode)) { LogPrintf("Register::ManageStatus() - Error upon calling SetKey: %s\n", errorMessage.c_str()); return; } if(!Register(vin, service, keyCollateralAddress, pubKeyCollateralAddress, keyMasternode, pubKeyMasternode, errorMessage)) { LogPrintf("CActiveMasternode::ManageStatus() - Error on Register: %s\n", errorMessage.c_str()); } return; } else { LogPrintf("CActiveMasternode::ManageStatus() - Could not find suitable coins!\n"); } } //send to all peers if(!Dseep(errorMessage)) { LogPrintf("CActiveMasternode::ManageStatus() - Error on Ping: %s", errorMessage.c_str()); } }
// // Bootup the Throne, look for a 1000DRK input and register on the network // void CActiveThrone::ManageStatus() { std::string errorMessage; if(!fThroNe) return; if (fDebug) LogPrintf("CActiveThrone::ManageStatus() - Begin\n"); //need correct adjusted time to send ping bool fIsInitialDownload = IsInitialBlockDownload(); if(fIsInitialDownload) { status = THRONE_SYNC_IN_PROCESS; LogPrintf("CActiveThrone::ManageStatus() - Sync in progress. Must wait until sync is complete to start Throne.\n"); return; } if(status == THRONE_INPUT_TOO_NEW || status == THRONE_NOT_CAPABLE || status == THRONE_SYNC_IN_PROCESS){ status = THRONE_NOT_PROCESSED; } if(status == THRONE_NOT_PROCESSED) { if(strThroNeAddr.empty()) { if(!GetLocal(service)) { notCapableReason = "Can't detect external address. Please use the Throneaddr configuration option."; status = THRONE_NOT_CAPABLE; LogPrintf("CActiveThrone::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } } else { service = CService(strThroNeAddr); } LogPrintf("CActiveThrone::ManageStatus() - Checking inbound connection to '%s'\n", service.ToString().c_str()); if(Params().NetworkID() == CChainParams::MAIN){ if(service.GetPort() != 9340) { notCapableReason = "Invalid port: " + boost::lexical_cast<string>(service.GetPort()) + " - only 9999 is supported on mainnet."; status = THRONE_NOT_CAPABLE; LogPrintf("CActiveThrone::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } } else if(service.GetPort() == 9340) { notCapableReason = "Invalid port: " + boost::lexical_cast<string>(service.GetPort()) + " - 9999 is only supported on mainnet."; status = THRONE_NOT_CAPABLE; LogPrintf("CActiveThrone::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } if(!ConnectNode((CAddress)service, service.ToString().c_str())){ notCapableReason = "Could not connect to " + service.ToString(); status = THRONE_NOT_CAPABLE; LogPrintf("CActiveThrone::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } if(pwalletMain->IsLocked()){ notCapableReason = "Wallet is locked."; status = THRONE_NOT_CAPABLE; LogPrintf("CActiveThrone::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } // Set defaults status = THRONE_NOT_CAPABLE; notCapableReason = "Unknown. Check debug.log for more information.\n"; // Choose coins to use CPubKey pubKeyCollateralAddress; CKey keyCollateralAddress; if(GetThroNeVin(vin, pubKeyCollateralAddress, keyCollateralAddress)) { if(GetInputAge(vin) < THRONE_MIN_CONFIRMATIONS){ notCapableReason = "Input must have least " + boost::lexical_cast<string>(THRONE_MIN_CONFIRMATIONS) + " confirmations - " + boost::lexical_cast<string>(GetInputAge(vin)) + " confirmations"; LogPrintf("CActiveThrone::ManageStatus() - %s\n", notCapableReason.c_str()); status = THRONE_INPUT_TOO_NEW; return; } LogPrintf("CActiveThrone::ManageStatus() - Is capable throne node!\n"); status = THRONE_IS_CAPABLE; notCapableReason = ""; pwalletMain->LockCoin(vin.prevout); // send to all nodes CPubKey pubKeyThrone; CKey keyThrone; if(!darkSendSigner.SetKey(strThroNePrivKey, errorMessage, keyThrone, pubKeyThrone)) { LogPrintf("Register::ManageStatus() - Error upon calling SetKey: %s\n", errorMessage.c_str()); return; } if(!Register(vin, service, keyCollateralAddress, pubKeyCollateralAddress, keyThrone, pubKeyThrone, errorMessage)) { LogPrintf("CActiveThrone::ManageStatus() - Error on Register: %s\n", errorMessage.c_str()); } return; } else { notCapableReason = "Could not find suitable coins!"; LogPrintf("CActiveThrone::ManageStatus() - %s\n", notCapableReason.c_str()); } } //send to all peers if(!Dseep(errorMessage)) { LogPrintf("CActiveThrone::ManageStatus() - Error on Ping: %s\n", errorMessage.c_str()); } }
// // Bootup the stormnode, look for a 500 DRKSLK input and register on the network // void CActiveStormnode::ManageStatus() { std::string errorMessage; if(!fStormNode) return; if (fDebug) LogPrintf("CActiveStormnode::ManageStatus() - Begin\n"); //need correct adjusted time to send ping bool fIsInitialDownload = IsInitialBlockDownload(); if(fIsInitialDownload) { status = STORMNODE_SYNC_IN_PROCESS; LogPrintf("CActiveStormnode::ManageStatus() - Sync in progress. Must wait until sync is complete to start stormnode.\n"); return; } if(status == STORMNODE_INPUT_TOO_NEW || status == STORMNODE_NOT_CAPABLE || status == STORMNODE_SYNC_IN_PROCESS){ status = STORMNODE_NOT_PROCESSED; } if(status == STORMNODE_NOT_PROCESSED) { if(strStormNodeAddr.empty()) { if(!GetLocal(service)) { notCapableReason = "Can't detect external address. Please use the stormnodeaddr configuration option."; status = STORMNODE_NOT_CAPABLE; LogPrintf("CActiveStormnode::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } } else { service = CService(strStormNodeAddr); } LogPrintf("CActiveStormnode::ManageStatus() - Checking inbound connection to '%s'\n", service.ToString().c_str()); // DRKSLKNOTE: There is no logical reason to restrict this to a specific port. Its a peer, what difference does it make. /* if(service.GetPort() != 9999) { notCapableReason = "Invalid port: " + boost::lexical_cast<string>(service.GetPort()) + " -only 9999 is supported on mainnet."; status = STORMNODE_NOT_CAPABLE; LogPrintf("CActiveStormnode::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } */ if(!ConnectNode((CAddress)service, service.ToString().c_str())){ notCapableReason = "Could not connect to " + service.ToString(); status = STORMNODE_NOT_CAPABLE; LogPrintf("CActiveStormnode::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } if(pwalletMain->IsLocked()){ notCapableReason = "Wallet is locked."; status = STORMNODE_NOT_CAPABLE; LogPrintf("CActiveStormnode::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } // Set defaults status = STORMNODE_NOT_CAPABLE; notCapableReason = "Unknown. Check debug.log for more information.\n"; // Choose coins to use CPubKey pubKeyCollateralAddress; CKey keyCollateralAddress; if(GetStormNodeVin(vin, pubKeyCollateralAddress, keyCollateralAddress)) { if(GetInputAge(vin) < STORMNODE_MIN_CONFIRMATIONS){ LogPrintf("CActiveStormnode::ManageStatus() - Input must have least %d confirmations - %d confirmations\n", STORMNODE_MIN_CONFIRMATIONS, GetInputAge(vin)); status = STORMNODE_INPUT_TOO_NEW; return; } LogPrintf("CActiveStormnode::ManageStatus() - Is capable master node!\n"); status = STORMNODE_IS_CAPABLE; notCapableReason = ""; pwalletMain->LockCoin(vin.prevout); // send to all nodes CPubKey pubKeyStormnode; CKey keyStormnode; if(!sandStormSigner.SetKey(strStormNodePrivKey, errorMessage, keyStormnode, pubKeyStormnode)) { LogPrintf("Register::ManageStatus() - Error upon calling SetKey: %s\n", errorMessage.c_str()); return; } if(!Register(vin, service, keyCollateralAddress, pubKeyCollateralAddress, keyStormnode, pubKeyStormnode, errorMessage)) { LogPrintf("CActiveStormnode::ManageStatus() - Error on Register: %s\n", errorMessage.c_str()); } return; } else { LogPrintf("CActiveStormnode::ManageStatus() - Could not find suitable coins!\n"); } } //send to all peers if(!Dseep(errorMessage)) { LogPrintf("CActiveStormnode::ManageStatus() - Error on Ping: %s", errorMessage.c_str()); } }