Skip to content

Commit 5d59483

Browse files
Merge pull request #644 from dantudor/patch-2
Adds proposalHash to the RPC getpaymentrequest
2 parents d501c89 + 6094b20 commit 5d59483

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

src/consensus/cfund.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,18 +547,21 @@ void CFund::CProposal::ToJson(UniValue& ret, CCoinsViewCache& coins) const {
547547
if (prequest.proposalhash != hash)
548548
continue;
549549

550-
prequest.ToJson(preq);
550+
prequest.ToJson(preq, false);
551551
arr.push_back(preq);
552552
}
553553

554554
ret.pushKV("paymentRequests", arr);
555555
}
556556
}
557557

558-
void CFund::CPaymentRequest::ToJson(UniValue& ret) const {
558+
void CFund::CPaymentRequest::ToJson(UniValue& ret, bool root) const {
559559
ret.pushKV("version", nVersion);
560560
ret.pushKV("hash", hash.ToString());
561561
ret.pushKV("blockHash", txblockhash.ToString());
562+
if (root) {
563+
ret.pushKV("proposalHash", proposalhash.ToString());
564+
}
562565
ret.pushKV("description", strDZeel);
563566
ret.pushKV("requestedAmount", FormatMoney(nAmount));
564567
ret.pushKV("votesYes", nVotesYes);

src/consensus/cfund.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class CPaymentRequest
172172
paymenthash.ToString().substr(0,10), strDZeel);
173173
}
174174

175-
void ToJson(UniValue& ret) const;
175+
void ToJson(UniValue& ret, bool root) const;
176176

177177
bool IsAccepted() const;
178178

src/rpc/blockchain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@ UniValue getpaymentrequest(const UniValue& params, bool fHelp)
15431543

15441544
UniValue ret(UniValue::VOBJ);
15451545

1546-
prequest.ToJson(ret);
1546+
prequest.ToJson(ret, true);
15471547

15481548
return ret;
15491549
}

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3625,7 +3625,7 @@ UniValue paymentrequestvotelist(const UniValue& params, bool fHelp)
36253625
auto it = std::find_if( vAddedPaymentRequestVotes.begin(), vAddedPaymentRequestVotes.end(),
36263626
[&prequest](const std::pair<std::string, bool>& element){ return element.first == prequest.hash.ToString();} );
36273627
UniValue p(UniValue::VOBJ);
3628-
prequest.ToJson(p);
3628+
prequest.ToJson(p, false);
36293629
if (it != vAddedPaymentRequestVotes.end()) {
36303630
if (it->second)
36313631
yesvotes.push_back(p);

0 commit comments

Comments
 (0)