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

Remove unused vars in mn_checks #1036

Merged
merged 3 commits into from
Jan 17, 2022
Merged
Changes from 2 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
17 changes: 7 additions & 10 deletions src/masternodes/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3106,9 +3106,6 @@ Res RevertCustomTx(CCustomCSView& mnview, const CCoinsViewCache& coins, const CT
}
auto txMessage = customTypeToMessage(txType);
CAccountsHistoryEraser view(mnview, height, txn, erasers);
uint256 vaultID;
std::string schemeID;
CLoanSchemeCreation globalScheme;
if ((res = CustomMetadataParse(height, consensus, metadata, txMessage))) {
res = CustomTxRevert(view, coins, tx, height, consensus, txMessage);

Expand Down Expand Up @@ -3178,7 +3175,7 @@ void PopulateVaultHistoryData(CHistoryWriters* writers, CAccountsHistoryWriter&
bool IsDisabledTx(uint32_t height, CustomTxType type, const Consensus::Params& consensus) {
if (height < consensus.FortCanningParkHeight)
return false;

// ICXCreateOrder = '1',
// ICXMakeOffer = '2',
// ICXSubmitDFCHTLC = '3',
Expand Down Expand Up @@ -3210,7 +3207,7 @@ Res ApplyCustomTx(CCustomCSView& mnview, const CCoinsViewCache& coins, const CTr


const auto metadataValidation = height >= consensus.FortCanningHeight;

auto txType = GuessCustomTxType(tx, metadata, metadataValidation);
if (txType == CustomTxType::None) {
return res;
Expand All @@ -3219,7 +3216,7 @@ Res ApplyCustomTx(CCustomCSView& mnview, const CCoinsViewCache& coins, const CTr
if (IsDisabledTx(height, txType, consensus)) {
return Res::ErrCode(CustomTxErrCodes::Fatal, "Disabled custom transaction");
}

if (metadataValidation && txType == CustomTxType::Reject) {
return Res::ErrCode(CustomTxErrCodes::Fatal, "Invalid custom transaction");
}
Expand Down Expand Up @@ -3535,7 +3532,7 @@ std::vector<std::vector<DCT_ID>> CPoolSwap::CalculatePoolPaths(CCustomCSView& vi

// Note: `testOnly` doesn't update views, and as such can result in a previous price calculations
// for a pool, if used multiple times (or duplicated pool IDs) with the same view.
// testOnly is only meant for one-off tests per well defined view.
// testOnly is only meant for one-off tests per well defined view.
Res CPoolSwap::ExecuteSwap(CCustomCSView& view, std::vector<DCT_ID> poolIDs, bool testOnly) {

CTokenAmount swapAmountResult{{},0};
Expand Down Expand Up @@ -3605,7 +3602,7 @@ Res CPoolSwap::ExecuteSwap(CCustomCSView& view, std::vector<DCT_ID> poolIDs, boo

// If we're just testing, don't do any balance transfers.
// Just go over pools and return result. The only way this can
// cause inaccurate result is if we go over the same path twice,
// cause inaccurate result is if we go over the same path twice,
// which shouldn't happen in the first place.
if (testOnly)
return Res::Ok();
Expand Down Expand Up @@ -3696,14 +3693,14 @@ Res SwapToDFIOverUSD(CCustomCSView & mnview, DCT_ID tokenId, CAmount amount, CS
bool IsVaultPriceValid(CCustomCSView& mnview, const CVaultId& vaultId, uint32_t height)
{
if (auto collaterals = mnview.GetVaultCollaterals(vaultId))
for (const auto collateral : collaterals->balances)
for (const auto& collateral : collaterals->balances)
if (auto collateralToken = mnview.HasLoanCollateralToken({collateral.first, height}))
if (auto fixedIntervalPrice = mnview.GetFixedIntervalPrice(collateralToken->fixedIntervalPriceId))
if (!fixedIntervalPrice.val->isLive(mnview.GetPriceDeviation()))
return false;

if (auto loans = mnview.GetLoanTokens(vaultId))
for (const auto loan : loans->balances)
for (const auto& loan : loans->balances)
if (auto loanToken = mnview.GetLoanTokenByID(loan.first))
if (auto fixedIntervalPrice = mnview.GetFixedIntervalPrice(loanToken->fixedIntervalPriceId))
if (!fixedIntervalPrice.val->isLive(mnview.GetPriceDeviation()))
Expand Down