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

Search all pools for previous version suffix #1270

Merged
merged 1 commit into from
May 23, 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
22 changes: 10 additions & 12 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3787,18 +3787,16 @@ static Res PoolSplits(CCustomCSView& view, CAmount& totalBalance, ATTRIBUTES& at

size_t suffixCount{1};
view.ForEachPoolPair([&, oldTokenId = oldTokenId](DCT_ID const & poolId, const CPoolPair& pool){
if (pool.idTokenA == oldTokenId || pool.idTokenB == oldTokenId) {
const auto tokenA = view.GetToken(pool.idTokenA);
const auto tokenB = view.GetToken(pool.idTokenB);
assert(tokenA);
assert(tokenB);
if ((tokenA->destructionHeight != -1 && tokenA->destructionTx != uint256{}) ||
(tokenB->destructionHeight != -1 && tokenB->destructionTx != uint256{})) {
const auto poolToken = view.GetToken(poolId);
assert(poolToken);
if (poolToken->symbol.find(oldPoolToken->symbol + "/v") != std::string::npos) {
++suffixCount;
}
const auto tokenA = view.GetToken(pool.idTokenA);
const auto tokenB = view.GetToken(pool.idTokenB);
assert(tokenA);
assert(tokenB);
if ((tokenA->destructionHeight != -1 && tokenA->destructionTx != uint256{}) ||
(tokenB->destructionHeight != -1 && tokenB->destructionTx != uint256{})) {
const auto poolToken = view.GetToken(poolId);
assert(poolToken);
if (poolToken->symbol.find(oldPoolToken->symbol + "/v") != std::string::npos) {
++suffixCount;
}
}
return true;
Expand Down