almost compiles

This commit is contained in:
Evan Duffield 2016-04-12 09:00:19 -07:00
parent 3c42774eb7
commit 019eb07ac0
7 changed files with 22 additions and 19 deletions

View File

@ -7,8 +7,8 @@
*
*/
template<typename T, typename S>
bool LoadFlatDB(T& objToLoad, CFlatDB<S>& flatdb)
template<typename T>
bool LoadFlatDB(T& objToLoad, CFlatDB<T>& flatdb)
{
CFlatDB_ReadResult readResult = flatdb.Read(objToLoad);
if (readResult == FileError)
@ -33,8 +33,8 @@ bool LoadFlatDB(T& objToLoad, CFlatDB<S>& flatdb)
return true;
}
template<typename T, typename S>
bool DumpFlatDB(T& objToSave, CFlatDB<S>& flatdb)
template<typename T>
bool DumpFlatDB(T& objToSave, CFlatDB<T>& flatdb)
{
int64_t nStart = GetTimeMillis();

View File

@ -30,11 +30,11 @@ class CFlatDB;
*
*/
template<typename T, typename S>
bool LoadFlatDB(T& objToLoad, CFlatDB<S>& flatdb);
template<typename T>
bool LoadFlatDB(T& objToLoad, CFlatDB<T>& flatdb);
template<typename T, typename S>
bool DumpFlatDB(T& objToSave, CFlatDB<S>& flatdb);
template<typename T>
bool DumpFlatDB(T& objToSave, CFlatDB<T>& flatdb);
/**
* Reusable flat database

View File

@ -163,7 +163,7 @@ std::string CFinalizedBudget::GetProposals()
std::string ret = "";
BOOST_FOREACH(CTxBudgetPayment& budgetPayment, vecBudgetPayments){
CBudgetProposal* pbudgetProposal = budget.FindProposal(budgetPayment.nProposalHash);
CBudgetProposal* pbudgetProposal = governance.FindProposal(budgetPayment.nProposalHash);
std::string token = budgetPayment.nProposalHash.ToString();
@ -187,7 +187,7 @@ std::string CFinalizedBudget::GetStatus()
continue;
}
CBudgetProposal* pbudgetProposal = budget.FindProposal(budgetPayment.nProposalHash);
CBudgetProposal* pbudgetProposal = governance.FindProposal(budgetPayment.nProposalHash);
if(!pbudgetProposal){
if(retBadHashes == ""){
retBadHashes = "Unknown proposal hash! Check this proposal before voting" + budgetPayment.nProposalHash.ToString();

View File

@ -34,10 +34,11 @@ static const int64_t GOVERNANCE_FEE_CONFIRMATIONS = 6;
static const int64_t GOVERNANCE_UPDATE_MIN = 60*60;
extern std::vector<CBudgetProposalBroadcast> vecImmatureBudgetProposals;
extern std::map<uint256, int64_t> askedForSourceProposalOrBudget;
extern CGovernanceManager governance;
//Check the collateral transaction for the budget proposal/finalized budget
bool IsCollateralValid(uint256 nTxCollateralHash, uint256 nExpectedHash, std::string& strError, int64_t& nTime, int& nConf, CAmount minFee);
extern bool IsCollateralValid(uint256 nTxCollateralHash, uint256 nExpectedHash, std::string& strError, int64_t& nTime, int& nConf, CAmount minFee);
/** Save Budget Manager (budget.dat)
*/

View File

@ -9,7 +9,8 @@
// todo 12.1 - remove the unused
#include "masternode-budget.h"
#include "masternode.h"
//#include "darksend.h"
#include "darksend.h"
#include "governance.h"
#include "masternodeman.h"
#include "masternode-sync.h"
#include "util.h"
@ -710,6 +711,8 @@ void CBudgetManager::CheckOrphanVotes()
{
LOCK(cs);
std::string strError = "";
std::map<uint256, CFinalizedBudgetVote>::iterator it2 = mapOrphanFinalizedBudgetVotes.begin();
while(it2 != mapOrphanFinalizedBudgetVotes.end()){
if(UpdateFinalizedBudget(((*it2).second),NULL, strError)){
@ -931,7 +934,7 @@ std::string CFinalizedBudget::GetProposals()
std::string ret = "";
BOOST_FOREACH(CTxBudgetPayment& budgetPayment, vecBudgetPayments){
CBudgetProposal* pbudgetProposal = budget.FindProposal(budgetPayment.nProposalHash);
CBudgetProposal* pbudgetProposal = governance.FindProposal(budgetPayment.nProposalHash);
std::string token = budgetPayment.nProposalHash.ToString();
@ -955,7 +958,7 @@ std::string CFinalizedBudget::GetStatus()
continue;
}
CBudgetProposal* pbudgetProposal = budget.FindProposal(budgetPayment.nProposalHash);
CBudgetProposal* pbudgetProposal = governance.FindProposal(budgetPayment.nProposalHash);
if(!pbudgetProposal){
if(retBadHashes == ""){
retBadHashes = "Unknown proposal hash! Check this proposal before voting" + budgetPayment.nProposalHash.ToString();
@ -995,7 +998,7 @@ bool CFinalizedBudget::IsValid(const CBlockIndex* pindex, std::string& strError,
std::string strError2 = "";
if(fCheckCollateral){
int nConf = 0;
if(!IsBudgetCollateralValid(nFeeTXHash, GetHash(), strError2, nTime, nConf)){
if(!IsCollateralValid(nFeeTXHash, GetHash(), strError2, nTime, nConf, BUDGET_FEE_TX)){
strError = "Invalid Collateral : " + strError2;
return false;
}

View File

@ -97,7 +97,7 @@ void CMasternodeSync::AddedMasternodeWinner(uint256 hash)
void CMasternodeSync::AddedBudgetItem(uint256 hash)
{
if(budget.mapSeenMasternodeBudgetProposals.count(hash) || budget.mapSeenMasternodeBudgetVotes.count(hash) ||
if(governance.mapSeenMasternodeBudgetProposals.count(hash) || governance.mapSeenMasternodeBudgetVotes.count(hash) ||
budget.mapSeenFinalizedBudgets.count(hash) || budget.mapSeenFinalizedBudgetVotes.count(hash)) {
lastBudgetItem = GetTime();
mapSeenSyncBudget[hash]++;
@ -368,7 +368,7 @@ void CMasternodeSync::Process()
// shall we move onto the next asset
if(countBudgetItemProp > 0 && countBudgetItemFin)
{
if(budget.CountProposalInventoryItems() >= (sumBudgetItemProp / countBudgetItemProp)*0.9)
if(governance.CountProposalInventoryItems() >= (sumBudgetItemProp / countBudgetItemProp)*0.9)
{
if(budget.CountFinalizedInventoryItems() >= (sumBudgetItemFin / countBudgetItemFin)*0.9)
{

View File

@ -6,7 +6,6 @@
#include "db.h"
#include "init.h"
#include "activemasternode.h"
#include "governance.h"
#include "masternode-budget.h"
#include "masternode-payments.h"
#include "masternode-sync.h"
@ -421,7 +420,7 @@ UniValue mnbudget(const UniValue& params, bool fHelp)
UniValue resultObj(UniValue::VOBJ);
CAmount nTotalAllotted = 0;
std::vector<CBudgetProposal*> winningProps = governance.GetBudget();
std::vector<CBudgetProposal*> winningProps = budget.GetBudget();
BOOST_FOREACH(CBudgetProposal* pbudgetProposal, winningProps)
{
nTotalAllotted += pbudgetProposal->GetAllotted();