Rangeproof validation and rewinding should fail gracefully

This commit is contained in:
Gregory Sanders 2017-03-31 10:58:03 -04:00
parent 5157fc17ba
commit 9d04bf58ba
2 changed files with 5 additions and 1 deletions

View file

@ -37,7 +37,7 @@ static Blind_ECC_Init ecc_init_on_load;
bool UnblindConfidentialPair(const CKey &key, const CConfidentialValue& confValue, const CConfidentialAsset& confAsset, const CConfidentialNonce& nNonce, const CScript& committedScript, const std::vector<unsigned char>& vchRangeproof, CAmount& amount_out, uint256& blinding_factor_out, CAsset& asset_out, uint256& asset_blinding_factor_out)
{
if (!key.IsValid()) {
if (!key.IsValid() || vchRangeproof.size() == 0) {
return false;
}
CPubKey ephemeral_key(nNonce.vchCommitment);

View file

@ -153,6 +153,10 @@ bool CachingRangeProofChecker::VerifyRangeProof(const std::vector<unsigned char>
return true;
}
if (vchRangeProof.size() == 0) {
return false;
}
uint64_t min_value, max_value;
secp256k1_pedersen_commitment commit;
if (secp256k1_pedersen_commitment_parse(secp256k1_ctx_verify_amounts, &commit, &vchValueCommitment[0]) != 1)