Skip to content

Commit

Permalink
Search all pools for previous version suffix (#1270)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar authored May 23, 2022
1 parent 507dcc9 commit b0a9e04
Showing 1 changed file with 10 additions and 12 deletions.
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

0 comments on commit b0a9e04

Please sign in to comment.