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

Fix issue with Sigma mint creation #741

Merged
merged 7 commits into from Oct 26, 2019

Conversation

@riordant
Copy link
Contributor

riordant commented Oct 18, 2019

PR intention

  • if using the same wallet.dat between two machines, the count is not synced. Therefore during mint transaction creation, we have to:
    • check the chain to see if this mint already exists
    • ensure the chain is synced for access to all mints

This PR adds that.

  • Adds tests for the same

  • reverts a bad change in ResetMintCount - The intention of this function is to reset the internal mint count to the value in the database.

  • Adds a function GetKeyFromKeypath which returns a CPubKey given the parameters of a HD keypath. This allows pulling an existing key during CreateMintSeed if the key already exists

@riordant riordant requested review from ultimaweapon and thebevrishot Oct 18, 2019
@qashban4 qashban4 requested review from levonpetrosyan93 and removed request for ultimaweapon Oct 18, 2019
Copy link
Contributor

levonpetrosyan93 left a comment

LGTM

@riordant riordant force-pushed the mintcreation-fix branch from 3122ace to 2be206e Oct 21, 2019
Copy link
Member

thebevrishot left a comment

I think we could make the test wallet_count_tests simpler.

qa/rpc-tests/sigma_remint_lockedwallet.py Outdated Show resolved Hide resolved
src/hdmint/wallet.h Outdated Show resolved Hide resolved
src/test/hdmint_tests.cpp Outdated Show resolved Hide resolved
src/test/hdmint_tests.cpp Outdated Show resolved Hide resolved
src/test/hdmint_tests.cpp Outdated Show resolved Hide resolved
src/test/hdmint_tests.cpp Outdated Show resolved Hide resolved
src/test/hdmint_tests.cpp Outdated Show resolved Hide resolved
src/hdmint/wallet.cpp Outdated Show resolved Hide resolved
src/hdmint/wallet.cpp Outdated Show resolved Hide resolved
@qashban4 qashban4 requested a review from psolstice Oct 23, 2019
BOOST_CHECK(zwalletMain->GetCount() == (TOTAL_MINTS+1));

}

This comment has been minimized.

Copy link
@psolstice

psolstice Oct 23, 2019

Contributor

I think we need a test where you are given a blockchain already having mints generated with current seed and future values of the counter. Then we need to ensure the code is picking that up correctly and generates next mint with no collision with the ones already in the blockchain. This is the current issue with mint creation after all.

By that I mean the potentially conflicting set of mints should be extracted from the blockchain and not be somehow added to a wallet.

This comment has been minimized.

Copy link
@riordant

riordant Oct 24, 2019

Author Contributor

Agree. Working on it

@thebevrishot

This comment has been minimized.

Copy link
Member

thebevrishot commented Oct 24, 2019

@riordant please resolve remaining request changes.

add test
Copy link
Member

thebevrishot left a comment

Please check the old request change

src/test/hdmint_tests.cpp Outdated Show resolved Hide resolved
@psolstice psolstice merged commit f64cd08 into master Oct 26, 2019
4 checks passed
4 checks passed
LGTM analysis: JavaScript No code changes detected
Details
LGTM analysis: C/C++ No new or fixed alerts
Details
LGTM analysis: Python No new or fixed alerts
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details
@a-bezrukov a-bezrukov deleted the mintcreation-fix branch Oct 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.