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 TxToJSON(), add IsValid() and GetAmount() support for naked blinder #3

Merged
merged 0 commits into from
Aug 11, 2017

Conversation

tdudz
Copy link

@tdudz tdudz commented Aug 11, 2017

couple quick fixes here that came up when using this for MW. added support for IsValid() and GetAmount() where the explicit amount of a naked blinder is assumed to always be zero.

also, the code had no specific execution pathway for a naked blinder in the TxToJSON() function (i noticed this when attempting to run decoderuntransaction). Instead of failing the IsExplicit() check and defaulting to the else statement, I changed it to explicitly check IsCommitment() and IsBlinder() so that they can be handled on their own. The assert(0) at the end should never be reached and will serve as a fail fast reminder in case anyone adds more output types or something. This should probably be added to the main elements code but I presume naked blinder support will be merged at some point so i'll keep it in this PR.

Also, a test should be added at some point that creates a tx with a naked blinder. If not, my (eventual) MW PR will certainly have txs that have this and will be tested against.

@tdudz tdudz changed the title fix TxToJSON(), ad IsValid() and GetAmount() support for naked blinder fix TxToJSON(), add IsValid() and GetAmount() support for naked blinder Aug 11, 2017
Copy link
Owner

@instagibbs instagibbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you fix the tab/space thing real quick

@@ -12,13 +12,15 @@

void CConfidentialAsset::SetToAsset(const CAsset& asset)
{
vchCommitment.clear();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 spaces instead of tabs

vchCommitment.reserve(nExplicitSize);
vchCommitment.push_back(1);
vchCommitment.insert(vchCommitment.end(), asset.begin(), asset.end());
}

void CConfidentialValue::SetToBlinder(const uint256& blinder)
{
vchCommitment.clear();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 spaces instead of tabs

@instagibbs instagibbs merged this pull request into instagibbs:nakedblinder Aug 11, 2017
instagibbs added a commit that referenced this pull request Dec 17, 2018
validation: change pindexPrev->nHeight + 1 to nHeight
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants