Skip to content

Commit

Permalink
Fix number of totalAuctions in getloaninfo RPC (#1124)
Browse files Browse the repository at this point in the history
* Fix number of totalAuctions in getloaninfo

* Remove use of GetAuction

* Add tests

Co-authored-by: Prasanna Loganathar <[email protected]>
  • Loading branch information
Jouzo and prasannavl authored Mar 18, 2022
1 parent 4d10561 commit 2419f51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/masternodes/rpc_loan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ UniValue getloaninfo(const JSONRPCRequest& request) {
});

pcustomcsview->ForEachVaultAuction([&](const CVaultId& vaultId, const CAuctionData& data) {
totalAuctions++;
totalAuctions += data.batchCount;
return true;
}, height);

Expand Down
3 changes: 3 additions & 0 deletions test/functional/feature_loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ def run_test(self):
assert_equal(len(auctionlist[0]['batches']), 3)
vault1 = self.nodes[0].getvault(vaultId1)

getloaninfo = self.nodes[0].getloaninfo()
assert_equal(getloaninfo['totals']['openAuctions'], 3)

# Fail auction bid
try:
self.nodes[0].placeauctionbid(vaultId1, 0, account, "410@TSLA")
Expand Down

0 comments on commit 2419f51

Please sign in to comment.