From 2419f511c11e9051ef89c81540cddbb9aa514e29 Mon Sep 17 00:00:00 2001 From: Jouzo Date: Fri, 18 Mar 2022 05:10:46 +0100 Subject: [PATCH] Fix number of totalAuctions in getloaninfo RPC (#1124) * Fix number of totalAuctions in getloaninfo * Remove use of GetAuction * Add tests Co-authored-by: Prasanna Loganathar --- src/masternodes/rpc_loan.cpp | 2 +- test/functional/feature_loan.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/masternodes/rpc_loan.cpp b/src/masternodes/rpc_loan.cpp index 8e3b9717332..587abc41d15 100644 --- a/src/masternodes/rpc_loan.cpp +++ b/src/masternodes/rpc_loan.cpp @@ -1288,7 +1288,7 @@ UniValue getloaninfo(const JSONRPCRequest& request) { }); pcustomcsview->ForEachVaultAuction([&](const CVaultId& vaultId, const CAuctionData& data) { - totalAuctions++; + totalAuctions += data.batchCount; return true; }, height); diff --git a/test/functional/feature_loan.py b/test/functional/feature_loan.py index 3a43246754c..aa689026c93 100755 --- a/test/functional/feature_loan.py +++ b/test/functional/feature_loan.py @@ -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")