Skip to content

Commit

Permalink
Use next set in proof creation if coin is in overlapping part of sets (
Browse files Browse the repository at this point in the history
…#1199)

* Use next set in proof creation if coin is in overlapping part of sets

* Failing build fixed
  • Loading branch information
levonpetrosyan93 committed May 17, 2023
1 parent 8d0f4a9 commit c95d82c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/wallet/lelantusjoinsplitbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,20 @@ void LelantusJoinSplitBuilder::CreateJoinSplit(

// get coin group
int groupId;

std::tie(std::ignore, groupId) = state->GetMintedCoinHeightAndId(pub);
int mintHeight;
std::tie(mintHeight, groupId) = state->GetMintedCoinHeightAndId(pub);

if (groupId < 0) {
throw std::runtime_error(_("One of the lelantus coins has not been found in the chain!"));
}

// Check if the coin is at overlapping parts of sets, use next set for proof creation if it is also in next set.
lelantus::CLelantusState::LelantusCoinGroupInfo nextCoinGroupInfo;
if (state->GetLatestCoinID() > groupId && state->GetCoinGroupInfo(groupId + 1, nextCoinGroupInfo)) {
if (nextCoinGroupInfo.firstBlock->nHeight <= mintHeight)
groupId += 1;
}

coins.emplace_back(std::make_pair(priv, groupId));
std::vector<unsigned char> setHash;
if (anonymity_sets.count(groupId) == 0) {
Expand Down

0 comments on commit c95d82c

Please sign in to comment.