remove asserts from verifyamounts, test commitment types

This commit is contained in:
Gregory Sanders 2017-09-21 09:12:32 -04:00
parent 808300b66e
commit 224f7b83be
2 changed files with 31 additions and 7 deletions

View file

@ -735,15 +735,14 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
if (!MoneyRange(val.GetAmount()))
return false;
assert(val.GetAmount() != 0);
if (secp256k1_pedersen_commit(secp256k1_ctx_verify_amounts, &commit, explBlinds, val.GetAmount(), &gen) != 1)
return false;
}
else {
assert(val.IsCommitment());
else if (val.IsCommitment()) {
if (secp256k1_pedersen_commitment_parse(secp256k1_ctx_verify_amounts, &commit, &val.vchCommitment[0]) != 1)
return false;
} else {
return false;
}
vData.push_back(commit);
@ -901,7 +900,6 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
return false;
}
else {
assert(false);
return false;
}
@ -921,10 +919,11 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
if (secp256k1_pedersen_commit(secp256k1_ctx_verify_amounts, &commit, explBlinds, val.GetAmount(), &gen) != 1)
return false;
}
else
{
else if (val.IsCommitment()) {
if (secp256k1_pedersen_commitment_parse(secp256k1_ctx_verify_amounts, &commit, &val.vchCommitment[0]) != 1)
return false;
} else {
return false;
}
vData.push_back(commit);