Allow masternode broadcasts to update masternode information regardless of state (#1094)

* Allow MN broadcasts to update MN information regardless of state

* Add masternode public keys to log output for debugging

* Moved log message from start-alias to CMasternodeBroadcast::Create

* Fixed log message
This commit is contained in:
Tim Flynn 2016-10-25 10:37:33 -04:00 committed by UdjinM6
parent 0cc4997501
commit e30f8bf6a0
2 changed files with 13 additions and 10 deletions

View File

@ -118,8 +118,7 @@ bool CActiveMasternode::SendMasternodePing(std::string& strErrorRet)
void CActiveMasternode::ManageStateInitial()
{
LogPrint("masternode", "CActiveMasternode::ManageStateInitial -- Start status = %s, type = %s, pinger enabled = %d\n", GetStatus(), GetType(), fPingerEnabled);
LogPrint("masternode", "CActiveMasternode::ManageStateInitial -- status = %s, type = %s, pinger enabled = %d\n", GetStatus(), GetType(), fPingerEnabled);
// Check that our local network configuration is correct
if(!GetLocal(service)) {
strNotCapableReason = "Can't detect external address. Please consider using the externalip configuration option if problem persists.";
@ -184,7 +183,12 @@ void CActiveMasternode::ManageStateInitial()
void CActiveMasternode::ManageStateRemote()
{
LogPrint("masternode", "CActiveMasternode::ManageStateRemote -- status = %s, type = %s, pinger enabled = %d\n", GetStatus(), GetType(), fPingerEnabled);
LogPrint("masternode", "CActiveMasternode::ManageStateRemote -- Start status = %s, type = %s, pinger enabled = %d, pubKeyMasternode.GetID() = %s\n",
GetStatus(),
GetType(),
fPingerEnabled,
pubKeyMasternode.GetID().ToString());
mnodeman.CheckMasternode(pubKeyMasternode);
masternode_info_t infoMn = mnodeman.GetMasternodeInfo(pubKeyMasternode);
if(infoMn.fInfoValid) {

View File

@ -393,6 +393,11 @@ bool CMasternodeBroadcast::Create(CTxIn txin, CService service, CKey keyCollater
// wait for reindex and/or import to finish
if (fImporting || fReindex) return false;
LogPrint("masternode", "CMasternodeBroadcast::Create -- pubKeyCollateralAddressNew = %s, pubKeyMasternodeNew.GetID() = %s\n",
CBitcoinAddress(pubKeyCollateralAddressNew.GetID()).ToString(),
pubKeyMasternodeNew.GetID().ToString());
CMasternodePing mnp(txin);
if(!mnp.Sign(keyMasternodeNew, pubKeyMasternodeNew)) {
strErrorRet = strprintf("Failed to sign ping, masternode=%s", txin.prevout.ToStringShort());
@ -509,9 +514,6 @@ bool CMasternodeBroadcast::Update(CMasternode* pmn, int& nDos)
return false;
}
// masternode is not enabled yet/already, nothing to update
if(!pmn->IsEnabled()) return false;
// IsVnAssociatedWithPubkey is validated once in CheckOutpoint, after that they just need to match
if(pmn->pubKeyCollateralAddress != pubKeyCollateralAddress) {
LogPrintf("CMasternodeMan::Update -- Got mismatched pubKeyCollateralAddress and vin\n");
@ -525,10 +527,7 @@ bool CMasternodeBroadcast::Update(CMasternode* pmn, int& nDos)
LogPrintf("CMasternodeBroadcast::Update -- Got UPDATED Masternode entry: addr=%s\n", addr.ToString());
if(pmn->UpdateFromNewBroadcast((*this))) {
pmn->Check();
// normally masternode should be in pre-enabled status after update, if not - do not relay
if(pmn->IsPreEnabled()) {
Relay();
}
Relay();
}
masternodeSync.AddedMasternodeList();
}