Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix dex loan token burns" #1193

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/masternodes/rpc_accounts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1779,8 +1779,6 @@ UniValue getburninfo(const JSONRPCRequest& request) {

UniValue dfipaybacktokens{UniValue::VARR};

LOCK(cs_main);

auto calcBurn = [&](AccountHistoryKey const & key, CLazySerialize<AccountHistoryValue> valueLazy) -> bool
{
const auto & value = valueLazy.get();
Expand Down Expand Up @@ -1824,11 +1822,7 @@ UniValue getburninfo(const JSONRPCRequest& request) {
if (value.category == uint8_t(CustomTxType::PoolSwap)
|| value.category == uint8_t(CustomTxType::PoolSwapV2)) {
for (auto const & diff : value.diff) {
if (pcustomcsview->GetLoanTokenByID(diff.first)) {
dexfeeburn.Add({diff.first, diff.second});
} else {
burntTokens.Add({diff.first, diff.second});
}
dexfeeburn.Add({diff.first, diff.second});
}
return true;
}
Expand All @@ -1854,6 +1848,8 @@ UniValue getburninfo(const JSONRPCRequest& request) {
result.pushKV("paybackburn", ValueFromAmount(paybackFee));
result.pushKV("dexfeetokens", AmountsToJSON(dexfeeburn.balances));

LOCK(cs_main);

if (auto attributes = pcustomcsview->GetAttributes()) {
CDataStructureV0 liveKey{AttributeTypes::Live, ParamIDs::Economy, EconomyKeys::PaybackDFITokens};
auto tokenBalances = attributes->GetValue(liveKey, CBalances{});
Expand Down