15 strProposalName(
"unknown"),
26 const std::string&
url,
35 strProposalName(
name),
37 nBlockStart(blockstart),
40 nFeeTXHash(nfeetxhash),
60 }
catch (std::exception& e) {
61 return error(
"Unable to deserialize proposal broadcast: %s", e.what());
96 strInvalid =
"Invalid nBlockEnd (end before start)";
111 if (
nAmount < PROPOSAL_MIN_AMOUNT) {
131 strInvalid =
"Multisig is not currently supported.";
155 strInvalid =
"Proposal name contains illegal characters.";
159 strInvalid =
"Proposal URL contains illegal characters.";
227 std::string strAction =
"New vote inserted:";
229 const int64_t voteTime = vote.
GetTime();
232 const int64_t& oldTime =
mapVotes[mnId].GetTime();
233 if (oldTime > voteTime) {
238 if (voteTime - oldTime < BUDGET_VOTE_UPDATE_MIN) {
239 strError =
strprintf(
"time between votes is too soon - %s - %lli sec < %lli sec\n",
240 vote.
GetHash().
ToString(), voteTime - oldTime, BUDGET_VOTE_UPDATE_MIN);
244 strAction =
"Existing vote updated:";
279 if (yeas + nays == 0)
return 0.0f;
281 return ((
double)(yeas) / (
double)(yeas + nays));
int64_t CAmount
Amount in PIV (Can be negative)
const CChainParams & Params()
Return the currently selected parameters.
void reserve(size_type n)
std::map< COutPoint, CBudgetVote > mapVotes
int GetRemainingPaymentCount(int nCurrentHeight) const
bool IsExpired(int nCurrentHeight) const
CDataStream GetBroadcast() const
bool updateExpired(int nCurrentHeight)
bool CheckAmount(const CAmount &nTotalBudget)
static int GetBlockCycle(int nCurrentHeight)
int GetBlockEndCycle() const
int GetVoteCount(CBudgetVote::VoteDirection vd) const
bool ParseBroadcast(CDataStream &broadcast)
void SetSynced(bool synced)
bool AddOrUpdateVote(const CBudgetVote &vote, std::string &strError)
std::string strProposalName
bool UpdateValid(int nHeight, int mnCount)
bool IsHeavilyDownvoted(int mnCount)
bool IsWellFormed(const CAmount &nTotalBudget)
void SyncVotes(CNode *pfrom, bool fPartial, int &nInvCount) const
int GetTotalPaymentCount() const
bool IsEstablished() const
UniValue GetVotesArray() const
bool IsPassing(int nBlockStartBudget, int nBlockEndBudget, int mnCount) const
int GetBlockStartCycle() const
void SetSynced(bool _fSynced)
VoteDirection GetDirection() const
const Consensus::Params & GetConsensus() const
Information about a peer.
void PushInventory(const CInv &inv)
An outpoint - a combination of a transaction hash and an index n into its vout.
Serialized script, used inside transaction inputs and outputs.
bool IsPayToScriptHash() const
bool push_back(const UniValue &val)
std::string ToString() const
std::unique_ptr< CConnman > g_connman
#define LogPrint(category,...)
bool IsValidDestination(const CWDestination &address)
#define LIMITED_STRING(obj, n)
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet, bool fColdStake)
Parse a standard scriptPubKey for the destination address.
boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyID > CTxDestination
A txout script template with a specific destination.
int64_t nProposalEstablishmentTime
bool error(const char *fmt, const Args &... args)
int64_t GetAdjustedTime()
const uint256 UINT256_ZERO
constant uint256 instances
std::string SanitizeString(const std::string &str, int rule)
Remove unsafe chars.