From 2f8c94416884cfa57bb6e1741f5f6a4a7de101b8 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Tue, 29 Sep 2015 17:50:09 +0300 Subject: [PATCH 1/3] fix #629 --- src/init.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index db615b4088ef3..deac30e4f93f5 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -914,11 +914,13 @@ bool AppInit2(boost::thread_group& threadGroup) boost::filesystem::path backupFile = backupPathStr + dateTimeStr; sourceFile.make_preferred(); backupFile.make_preferred(); - try { - boost::filesystem::copy_file(sourceFile, backupFile); - LogPrintf("Creating backup of %s -> %s\n", sourceFile, backupFile); - } catch(boost::filesystem::filesystem_error &error) { - LogPrintf("Failed to create backup %s\n", error.what()); + if(boost::filesystem::exists(sourceFile)) { + try { + boost::filesystem::copy_file(sourceFile, backupFile); + LogPrintf("Creating backup of %s -> %s\n", sourceFile, backupFile); + } catch(boost::filesystem::filesystem_error &error) { + LogPrintf("Failed to create backup %s\n", error.what()); + } } // Keep only the last 10 backups, including the new one of course typedef std::multimap folder_set_t; From f4afaec0b2cce5d0861b8a9d408b0641d17a1bc6 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 30 Sep 2015 04:24:29 +0300 Subject: [PATCH 2/3] add missing maps cleaning in CMasternodeMan::Clear() --- src/masternodeman.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 35eef991acff2..429df7d002b5b 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -354,6 +354,8 @@ void CMasternodeMan::Clear() mAskedUsForMasternodeList.clear(); mWeAskedForMasternodeList.clear(); mWeAskedForMasternodeListEntry.clear(); + mapSeenMasternodeBroadcast.clear(); + mapSeenMasternodePing.clear(); nDsqCount = 0; } From b901fdb60dada44d4506588c454775c2c283ed33 Mon Sep 17 00:00:00 2001 From: TheLazieR Yip Date: Fri, 2 Oct 2015 14:21:49 +0700 Subject: [PATCH 3/3] Fix Misbehaving counting during Masternode Sync. --- src/masternode-budget.cpp | 4 ++-- src/masternode-payments.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/masternode-budget.cpp b/src/masternode-budget.cpp index 303413cd982e8..4655e3e7cfb6e 100644 --- a/src/masternode-budget.cpp +++ b/src/masternode-budget.cpp @@ -956,7 +956,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData mapSeenMasternodeBudgetVotes.insert(make_pair(vote.GetHash(), vote)); if(!vote.SignatureValid(true)){ LogPrintf("mvote - signature invalid\n"); - Misbehaving(pfrom->GetId(), 20); + if(masternodeSync.IsSynced()) Misbehaving(pfrom->GetId(), 20); // it could just be a non-synced masternode mnodeman.AskForMN(pfrom, vote.vin); return; @@ -1026,7 +1026,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData mapSeenFinalizedBudgetVotes.insert(make_pair(vote.GetHash(), vote)); if(!vote.SignatureValid(true)){ LogPrintf("fbvote - signature invalid\n"); - Misbehaving(pfrom->GetId(), 20); + if(masternodeSync.IsSynced()) Misbehaving(pfrom->GetId(), 20); // it could just be a non-synced masternode mnodeman.AskForMN(pfrom, vote.vin); return; diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index 8608c0bc0efdc..5e756cf97ea22 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -394,7 +394,7 @@ void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::st if(!winner.SignatureValid()){ LogPrintf("mnw - invalid signature\n"); - Misbehaving(pfrom->GetId(), 20); + if(masternodeSync.IsSynced()) Misbehaving(pfrom->GetId(), 20); // it could just be a non-synced masternode mnodeman.AskForMN(pfrom, winner.vinMasternode); return; @@ -656,7 +656,7 @@ bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError) { strError = strprintf("Masternode not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL, n); LogPrintf("CMasternodePaymentWinner::IsValid - %s\n", strError); - Misbehaving(pnode->GetId(), 20); + if(masternodeSync.IsSynced()) Misbehaving(pnode->GetId(), 20); } return false; }