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

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

Merged
merged 2 commits into from
Sep 19, 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
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