Skip to content

Commit 4ff2780

Browse files
Merge pull request #524 from mxaddict/patch-25
Updated ./src/univalue from upstream
2 parents 82a2ba8 + 8faa04e commit 4ff2780

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1506
-1008
lines changed

src/consensus/cfund.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ bool CFund::RemoveVotePaymentRequest(uint256 proposalHash)
139139
}
140140

141141
bool CFund::IsValidPaymentRequest(CTransaction tx, CCoinsViewCache& coins, int nMaxVersion)
142-
{
142+
{
143143
if(tx.strDZeel.length() > 1024)
144144
return error("%s: Too long strdzeel for payment request %s", __func__, tx.GetHash().ToString());
145145

@@ -211,7 +211,7 @@ bool CFund::IsValidPaymentRequest(CTransaction tx, CCoinsViewCache& coins, int n
211211
if(nAmount > proposal.GetAvailable(coins, true))
212212
return error("%s: Invalid requested amount for payment request %s (%d vs %d available)",
213213
__func__, tx.GetHash().ToString(), nAmount, proposal.GetAvailable(coins, true));
214-
214+
215215
bool ret = (nVersion <= nMaxVersion);
216216

217217
if(!ret)
@@ -504,31 +504,31 @@ std::string CFund::CProposal::GetState(uint32_t currentTime) const {
504504
void CFund::CProposal::ToJson(UniValue& ret, CCoinsViewCache& coins) const {
505505
AssertLockHeld(cs_main);
506506

507-
ret.push_back(Pair("version", nVersion));
508-
ret.push_back(Pair("hash", hash.ToString()));
509-
ret.push_back(Pair("blockHash", txblockhash.ToString()));
510-
ret.push_back(Pair("description", strDZeel));
511-
ret.push_back(Pair("requestedAmount", FormatMoney(nAmount)));
512-
ret.push_back(Pair("notPaidYet", FormatMoney(GetAvailable(coins))));
513-
ret.push_back(Pair("userPaidFee", FormatMoney(nFee)));
514-
ret.push_back(Pair("paymentAddress", Address));
507+
ret.pushKV("version", nVersion);
508+
ret.pushKV("hash", hash.ToString());
509+
ret.pushKV("blockHash", txblockhash.ToString());
510+
ret.pushKV("description", strDZeel);
511+
ret.pushKV("requestedAmount", FormatMoney(nAmount));
512+
ret.pushKV("notPaidYet", FormatMoney(GetAvailable(coins)));
513+
ret.pushKV("userPaidFee", FormatMoney(nFee));
514+
ret.pushKV("paymentAddress", Address);
515515
if(nVersion >= 2) {
516-
ret.push_back(Pair("proposalDuration", (uint64_t)nDeadline));
516+
ret.pushKV("proposalDuration", (uint64_t)nDeadline);
517517
if (fState == ACCEPTED && mapBlockIndex.count(blockhash) > 0) {
518518
CBlockIndex* pBlockIndex = mapBlockIndex[blockhash];
519-
ret.push_back(Pair("expiresOn", pBlockIndex->GetBlockTime() + (uint64_t)nDeadline));
519+
ret.pushKV("expiresOn", pBlockIndex->GetBlockTime() + (uint64_t)nDeadline);
520520
}
521521
} else {
522-
ret.push_back(Pair("expiresOn", (uint64_t)nDeadline));
522+
ret.pushKV("expiresOn", (uint64_t)nDeadline);
523523
}
524-
ret.push_back(Pair("votesYes", nVotesYes));
525-
ret.push_back(Pair("votesNo", nVotesNo));
526-
ret.push_back(Pair("votingCycle", (uint64_t)std::min(nVotingCycle, Params().GetConsensus().nCyclesProposalVoting)));
524+
ret.pushKV("votesYes", nVotesYes);
525+
ret.pushKV("votesNo", nVotesNo);
526+
ret.pushKV("votingCycle", (uint64_t)std::min(nVotingCycle, Params().GetConsensus().nCyclesProposalVoting));
527527
// votingCycle does not return higher than nCyclesProposalVoting to avoid reader confusion, since votes are not counted anyway when votingCycle > nCyclesProposalVoting
528-
ret.push_back(Pair("status", GetState(chainActive.Tip()->GetBlockTime())));
529-
ret.push_back(Pair("state", (uint64_t)fState));
528+
ret.pushKV("status", GetState(chainActive.Tip()->GetBlockTime()));
529+
ret.pushKV("state", (uint64_t)fState);
530530
if(fState == ACCEPTED)
531-
ret.push_back(Pair("stateChangedOnBlock", blockhash.ToString()));
531+
ret.pushKV("stateChangedOnBlock", blockhash.ToString());
532532
CPaymentRequestMap mapPaymentRequests;
533533

534534
if(pcoinsTip->GetAllPaymentRequests(mapPaymentRequests))
@@ -551,25 +551,25 @@ void CFund::CProposal::ToJson(UniValue& ret, CCoinsViewCache& coins) const {
551551
arr.push_back(preq);
552552
}
553553

554-
ret.push_back(Pair("paymentRequests", arr));
554+
ret.pushKV("paymentRequests", arr);
555555
}
556556
}
557557

558558
void CFund::CPaymentRequest::ToJson(UniValue& ret) const {
559-
ret.push_back(Pair("version", nVersion));
560-
ret.push_back(Pair("hash", hash.ToString()));
561-
ret.push_back(Pair("blockHash", txblockhash.ToString()));
562-
ret.push_back(Pair("description", strDZeel));
563-
ret.push_back(Pair("requestedAmount", FormatMoney(nAmount)));
564-
ret.push_back(Pair("votesYes", nVotesYes));
565-
ret.push_back(Pair("votesNo", nVotesNo));
566-
ret.push_back(Pair("votingCycle", (uint64_t)std::min(nVotingCycle, Params().GetConsensus().nCyclesPaymentRequestVoting)));
559+
ret.pushKV("version", nVersion);
560+
ret.pushKV("hash", hash.ToString());
561+
ret.pushKV("blockHash", txblockhash.ToString());
562+
ret.pushKV("description", strDZeel);
563+
ret.pushKV("requestedAmount", FormatMoney(nAmount));
564+
ret.pushKV("votesYes", nVotesYes);
565+
ret.pushKV("votesNo", nVotesNo);
566+
ret.pushKV("votingCycle", (uint64_t)std::min(nVotingCycle, Params().GetConsensus().nCyclesPaymentRequestVoting));
567567
// votingCycle does not return higher than nCyclesPaymentRequestVoting to avoid reader confusion, since votes are not counted anyway when votingCycle > nCyclesPaymentRequestVoting
568-
ret.push_back(Pair("status", GetState()));
569-
ret.push_back(Pair("state", (uint64_t)fState));
570-
ret.push_back(Pair("stateChangedOnBlock", blockhash.ToString()));
571-
if(fState == ACCEPTED) {
572-
ret.push_back(Pair("paidOnBlock", paymenthash.ToString()));
568+
ret.pushKV("status", GetState());
569+
ret.pushKV("state", (uint64_t)fState);
570+
ret.pushKV("stateChangedOnBlock", blockhash.ToString());
571+
if(fState == ACCEPTED) {
572+
ret.pushKV("paidOnBlock", paymenthash.ToString());
573573
}
574574
}
575575

src/qt/communityfundcreatepaymentrequestdialog.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ void CommunityFundCreatePaymentRequestDialog::click_pushButtonSubmitPaymentReque
207207

208208
UniValue strDZeel(UniValue::VOBJ);
209209

210-
strDZeel.push_back(Pair("h",ui->lineEditProposalHash->text().toStdString()));
211-
strDZeel.push_back(Pair("n",nReqAmount));
212-
strDZeel.push_back(Pair("s",Signature));
213-
strDZeel.push_back(Pair("r",sRandom));
214-
strDZeel.push_back(Pair("i",id));
215-
strDZeel.push_back(Pair("v",IsReducedCFundQuorumEnabled(chainActive.Tip(), Params().GetConsensus()) ? CFund::CPaymentRequest::CURRENT_VERSION : 2));
210+
strDZeel.pushKV("h",ui->lineEditProposalHash->text().toStdString());
211+
strDZeel.pushKV("n",nReqAmount);
212+
strDZeel.pushKV("s",Signature);
213+
strDZeel.pushKV("r",sRandom);
214+
strDZeel.pushKV("i",id);
215+
strDZeel.pushKV("v",IsReducedCFundQuorumEnabled(chainActive.Tip(), Params().GetConsensus()) ? CFund::CPaymentRequest::CURRENT_VERSION : 2);
216216

217217
wtx.strDZeel = strDZeel.write();
218218
wtx.nCustomVersion = CTransaction::PAYMENT_REQUEST_VERSION;

src/qt/communityfundcreateproposaldialog.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ void CommunityFundCreateProposalDialog::click_pushButtonCreateProposal()
136136

137137
UniValue strDZeel(UniValue::VOBJ);
138138

139-
strDZeel.push_back(Pair("n",nReqAmount));
140-
strDZeel.push_back(Pair("a",Address));
141-
strDZeel.push_back(Pair("d",nDeadline));
142-
strDZeel.push_back(Pair("s",sDesc));
143-
strDZeel.push_back(Pair("v",IsReducedCFundQuorumEnabled(chainActive.Tip(), Params().GetConsensus()) ? CFund::CProposal::CURRENT_VERSION : 2));
139+
strDZeel.pushKV("n",nReqAmount);
140+
strDZeel.pushKV("a",Address);
141+
strDZeel.pushKV("d",nDeadline);
142+
strDZeel.pushKV("s",sDesc);
143+
strDZeel.pushKV("v",IsReducedCFundQuorumEnabled(chainActive.Tip(), Params().GetConsensus()) ? CFund::CProposal::CURRENT_VERSION : 2);
144144

145145
wtx.strDZeel = strDZeel.write();
146146
wtx.nCustomVersion = CTransaction::PROPOSAL_VERSION;
@@ -240,7 +240,7 @@ void CommunityFundCreateProposalDialog::click_pushButtonCreateProposal()
240240
return;
241241
}
242242
}
243-
}
243+
}
244244
}
245245
else
246246
{

src/rest.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -565,24 +565,24 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
565565

566566
// pack in some essentials
567567
// use more or less the same output as mentioned in Bip64
568-
objGetUTXOResponse.push_back(Pair("chainHeight", chainActive.Height()));
569-
objGetUTXOResponse.push_back(Pair("chaintipHash", chainActive.Tip()->GetBlockHash().GetHex()));
570-
objGetUTXOResponse.push_back(Pair("bitmap", bitmapStringRepresentation));
568+
objGetUTXOResponse.pushKV("chainHeight", chainActive.Height());
569+
objGetUTXOResponse.pushKV("chaintipHash", chainActive.Tip()->GetBlockHash().GetHex());
570+
objGetUTXOResponse.pushKV("bitmap", bitmapStringRepresentation);
571571

572572
UniValue utxos(UniValue::VARR);
573573
BOOST_FOREACH (const CCoin& coin, outs) {
574574
UniValue utxo(UniValue::VOBJ);
575-
utxo.push_back(Pair("txvers", (int32_t)coin.nTxVer));
576-
utxo.push_back(Pair("height", (int32_t)coin.nHeight));
577-
utxo.push_back(Pair("value", ValueFromAmount(coin.out.nValue)));
575+
utxo.pushKV("txvers", (int32_t)coin.nTxVer);
576+
utxo.pushKV("height", (int32_t)coin.nHeight);
577+
utxo.pushKV("value", ValueFromAmount(coin.out.nValue));
578578

579579
// include the script in a json output
580580
UniValue o(UniValue::VOBJ);
581581
ScriptPubKeyToJSON(coin.out.scriptPubKey, o, true);
582-
utxo.push_back(Pair("scriptPubKey", o));
582+
utxo.pushKV("scriptPubKey", o);
583583
utxos.push_back(utxo);
584584
}
585-
objGetUTXOResponse.push_back(Pair("utxos", utxos));
585+
objGetUTXOResponse.pushKV("utxos", utxos);
586586

587587
// return json string
588588
string strJSON = objGetUTXOResponse.write() + "\n";

0 commit comments

Comments
 (0)