@@ -139,7 +139,7 @@ bool CFund::RemoveVotePaymentRequest(uint256 proposalHash)
139
139
}
140
140
141
141
bool CFund::IsValidPaymentRequest (CTransaction tx, CCoinsViewCache& coins, int nMaxVersion)
142
- {
142
+ {
143
143
if (tx.strDZeel .length () > 1024 )
144
144
return error (" %s: Too long strdzeel for payment request %s" , __func__, tx.GetHash ().ToString ());
145
145
@@ -211,7 +211,7 @@ bool CFund::IsValidPaymentRequest(CTransaction tx, CCoinsViewCache& coins, int n
211
211
if (nAmount > proposal.GetAvailable (coins, true ))
212
212
return error (" %s: Invalid requested amount for payment request %s (%d vs %d available)" ,
213
213
__func__, tx.GetHash ().ToString (), nAmount, proposal.GetAvailable (coins, true ));
214
-
214
+
215
215
bool ret = (nVersion <= nMaxVersion);
216
216
217
217
if (!ret)
@@ -504,31 +504,31 @@ std::string CFund::CProposal::GetState(uint32_t currentTime) const {
504
504
void CFund::CProposal::ToJson (UniValue& ret, CCoinsViewCache& coins) const {
505
505
AssertLockHeld (cs_main);
506
506
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);
515
515
if (nVersion >= 2 ) {
516
- ret.push_back ( Pair ( " proposalDuration" , (uint64_t )nDeadline) );
516
+ ret.pushKV ( " proposalDuration" , (uint64_t )nDeadline);
517
517
if (fState == ACCEPTED && mapBlockIndex.count (blockhash) > 0 ) {
518
518
CBlockIndex* pBlockIndex = mapBlockIndex[blockhash];
519
- ret.push_back ( Pair ( " expiresOn" , pBlockIndex->GetBlockTime () + (uint64_t )nDeadline) );
519
+ ret.pushKV ( " expiresOn" , pBlockIndex->GetBlockTime () + (uint64_t )nDeadline);
520
520
}
521
521
} else {
522
- ret.push_back ( Pair ( " expiresOn" , (uint64_t )nDeadline) );
522
+ ret.pushKV ( " expiresOn" , (uint64_t )nDeadline);
523
523
}
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 ));
527
527
// 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 );
530
530
if (fState == ACCEPTED)
531
- ret.push_back ( Pair ( " stateChangedOnBlock" , blockhash.ToString () ));
531
+ ret.pushKV ( " stateChangedOnBlock" , blockhash.ToString ());
532
532
CPaymentRequestMap mapPaymentRequests;
533
533
534
534
if (pcoinsTip->GetAllPaymentRequests (mapPaymentRequests))
@@ -551,25 +551,25 @@ void CFund::CProposal::ToJson(UniValue& ret, CCoinsViewCache& coins) const {
551
551
arr.push_back (preq);
552
552
}
553
553
554
- ret.push_back ( Pair ( " paymentRequests" , arr) );
554
+ ret.pushKV ( " paymentRequests" , arr);
555
555
}
556
556
}
557
557
558
558
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 ));
567
567
// 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 ());
573
573
}
574
574
}
575
575
0 commit comments