Consensus: Add asset type to CTxOut and validation

This commit is contained in:
Gregory Sanders 2016-12-01 09:34:31 -05:00
parent c63b8e9803
commit 05bc6db085
19 changed files with 196 additions and 90 deletions

View file

@ -112,7 +112,7 @@ bool CachingTransactionSignatureChecker::VerifySignature(const std::vector<unsig
return true;
}
bool CachingRangeProofChecker::VerifyRangeProof(const std::vector<unsigned char>& vchRangeProof, const std::vector<unsigned char>& vchCommitment, const secp256k1_context* secp256k1_ctx_verify_amounts) const
bool CachingRangeProofChecker::VerifyRangeProof(const std::vector<unsigned char>& vchRangeProof, const std::vector<unsigned char>& vchCommitment, const std::vector<unsigned char>& vchAssetTag, const secp256k1_context* secp256k1_ctx_verify_amounts) const
{
static CSignatureCache rangeProofCache;
@ -131,7 +131,12 @@ bool CachingRangeProofChecker::VerifyRangeProof(const std::vector<unsigned char>
secp256k1_pedersen_commitment commit;
if (secp256k1_pedersen_commitment_parse(secp256k1_ctx_verify_amounts, &commit, &vchCommitment[0]) != 1)
return false;
if (!secp256k1_rangeproof_verify(secp256k1_ctx_verify_amounts, &min_value, &max_value, &commit, vchRangeProof.data(), vchRangeProof.size(), NULL, 0, secp256k1_generator_h)) {
secp256k1_generator tag;
if (secp256k1_generator_parse(secp256k1_ctx_verify_amounts, &tag, &vchAssetTag[0]) != 1)
return false;
if (!secp256k1_rangeproof_verify(secp256k1_ctx_verify_amounts, &min_value, &max_value, &commit, vchRangeProof.data(), vchRangeProof.size(), NULL, 0, &tag)) {
return false;
}

View file

@ -38,7 +38,7 @@ public:
store = storeIn;
};
bool VerifyRangeProof(const std::vector<unsigned char>& vchRangeProof, const std::vector<unsigned char>& vchCommitment, const secp256k1_context* ctx) const;
bool VerifyRangeProof(const std::vector<unsigned char>& vchRangeProof, const std::vector<unsigned char>& vchCommitment, const std::vector<unsigned char>& vchAssetTag, const secp256k1_context* ctx) const;
};