Skip to content

Commit c59b4d4

Browse files
committed
#1661 fixed available amount
1 parent c50123e commit c59b4d4

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

wallet/api/api.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,8 @@ OfferInput collectOfferInput(const JsonRpcId& id, const json& params)
17921792
resItem.tx,
17931793
item,
17941794
resItem.txHeight,
1795-
resItem.systemHeight);
1795+
resItem.systemHeight,
1796+
true);
17961797
msg["result"].push_back(item);
17971798
}
17981799
}

wallet/api/api_handler.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace
4444
{
4545
storage::Totals allTotals(*walletDB);
4646
const auto& totals = allTotals.GetBeamTotals();
47-
const auto available = AmountBig::get_Lo(totals.Avail);
47+
const auto available = AmountBig::get_Lo(totals.Avail) + AmountBig::get_Lo(totals.AvailShielded);
4848
if (beamAmount + beamFee > available)
4949
{
5050
throw NotEnoughtBeams();
@@ -914,10 +914,10 @@ namespace beam::wallet
914914
storage::Totals allTotals(*walletDB);
915915
const auto& totals = allTotals.GetBeamTotals();
916916

917-
response.available = AmountBig::get_Lo(totals.Avail);
918-
response.receiving = AmountBig::get_Lo(totals.Incoming);
919-
response.sending = AmountBig::get_Lo(totals.Outgoing);
920-
response.maturing = AmountBig::get_Lo(totals.Maturing);
917+
response.available = AmountBig::get_Lo(totals.Avail); response.available += AmountBig::get_Lo(totals.AvailShielded);
918+
response.receiving = AmountBig::get_Lo(totals.Incoming); response.receiving += AmountBig::get_Lo(totals.IncomingShielded);
919+
response.sending = AmountBig::get_Lo(totals.Outgoing); response.sending += AmountBig::get_Lo(totals.OutgoingShielded);
920+
response.maturing = AmountBig::get_Lo(totals.Maturing); response.maturing += AmountBig::get_Lo(totals.MaturingShielded);
921921

922922
if (data.withAssets)
923923
{
@@ -1031,10 +1031,6 @@ namespace beam::wallet
10311031
return data.count == 0 || counter < data.count;
10321032
}, filter);
10331033
assert(data.count == 0 || (int)res.resultList.size() <= data.count);
1034-
std::sort(res.resultList.begin(), res.resultList.end(), [](const auto& a, const auto& b)
1035-
{
1036-
return a.tx.m_minHeight > b.tx.m_minHeight;
1037-
});
10381034
}
10391035

10401036
doResponse(id, res);

0 commit comments

Comments
 (0)