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

Add revert for PaybackV2 #1316

Merged
merged 2 commits into from
May 31, 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
12 changes: 11 additions & 1 deletion src/masternodes/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,7 @@ class CCustomTxApplyVisitor : public CCustomTxVisitor
auto balances = attributes->GetValue(liveKey, CBalances{});

// Can be removed after the hard fork, since it will be backward compatible
// but have to keep it around for pre 2.8.0 nodes for now
// but have to keep it around for pre 2.8.0 nodes for now
if (height >= static_cast<uint32_t>(consensus.FortCanningCrunchHeight)) {
CalculateOwnerRewards(obj.owner);
}
Expand Down Expand Up @@ -3693,6 +3693,16 @@ class CCustomTxRevertVisitor : public CCustomTxVisitor
return EraseHistory(vault->ownerAddress);
}

Res operator()(const CLoanPaybackLoanV2Message& obj) const {
const auto vault = mnview.GetVault(obj.vaultId);
if (!vault)
return Res::Err("Vault <%s> not found", obj.vaultId.GetHex());

EraseHistory(obj.from);
EraseHistory(consensus.burnAddress);
return EraseHistory(vault->ownerAddress);
}

Res operator()(const CAuctionBidMessage& obj) const {
if (auto bid = mnview.GetAuctionBid({obj.vaultId, obj.index}))
EraseHistory(bid->first);
Expand Down