mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
Merge #364: Non-malleable zero-knowlege proofs
6f80bceRemove redundant checks of size of range proof and surjection proof (Tim Ruffing)7ad4d95Reject issuances with explicit values but non-empty range proofs (Tim Ruffing)
This commit is contained in:
commit
375c022308
1 changed files with 8 additions and 5 deletions
|
|
@ -719,6 +719,10 @@ static bool VerifyIssuanceAmount(secp256k1_pedersen_commitment& commit, secp256k
|
|||
if (!MoneyRange(value.GetAmount()) || value.GetAmount() == 0) {
|
||||
return false;
|
||||
}
|
||||
if (!vchRangeproof.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
ret = secp256k1_pedersen_commit(secp256k1_ctx_verify_amounts, &commit, explBlinds, value.GetAmount(), &gen);
|
||||
// The explBlinds are all 0, and the amount is not 0. So secp256k1_pedersen_commit does not fail.
|
||||
|
|
@ -901,10 +905,9 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
|||
{
|
||||
const CConfidentialValue& val = tx.vout[i].nValue;
|
||||
const CConfidentialAsset& asset = tx.vout[i].nAsset;
|
||||
const CTxOutWitness* ptxoutwit = tx.wit.vtxoutwit.size() <= i? NULL: &tx.wit.vtxoutwit[i];
|
||||
if (!asset.IsValid() || (ptxoutwit && ptxoutwit->vchSurjectionproof.size() > 5000))
|
||||
if (!asset.IsValid())
|
||||
return false;
|
||||
if (!val.IsValid() || (ptxoutwit && ptxoutwit->vchRangeproof.size() > 5000))
|
||||
if (!val.IsValid())
|
||||
return false;
|
||||
if (!tx.vout[i].nNonce.IsValid())
|
||||
return false;
|
||||
|
|
@ -973,7 +976,7 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
|||
assert(ret != 0);
|
||||
secp256k1_generator_serialize(secp256k1_ctx_verify_amounts, &vchAssetCommitment[0], &gen);
|
||||
}
|
||||
if (!ptxoutwit || ptxoutwit->vchRangeproof.size() > 5000) {
|
||||
if (!ptxoutwit) {
|
||||
return false;
|
||||
}
|
||||
if (QueueCheck(pvChecks, new CRangeCheck(&val, ptxoutwit->vchRangeproof, vchAssetCommitment, tx.vout[i].scriptPubKey, cacheStore)) != SCRIPT_ERR_OK) {
|
||||
|
|
@ -993,7 +996,7 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (!ptxoutwit || ptxoutwit->vchSurjectionproof.size() > 5000)
|
||||
if (!ptxoutwit)
|
||||
return false;
|
||||
if (secp256k1_generator_parse(secp256k1_ctx_verify_amounts, &gen, &asset.vchCommitment[0]) != 1)
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue