Skip to content

Commit 212c43f

Browse files
delta1psgreco
authored andcommitted
fix: range proof cache bind to asset and scriptpubkey
(cherry picked from commit 6253d7e)
1 parent 644c14d commit 212c43f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/script/sigcache.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ class CSignatureCache
7272
}
7373

7474
// ELEMENTS:
75-
void ComputeEntryRangeProof(uint256& entry, const std::vector<unsigned char>& proof, const std::vector<unsigned char>& commitment) {
75+
void ComputeEntryRangeProof(uint256& entry, const std::vector<unsigned char>& proof, const std::vector<unsigned char>& commitment, const std::vector<unsigned char>& asset_commitment, const CScript& scriptPubKey) {
7676
CSHA256 hasher = m_salted_hasher_range_proof;
77-
hasher.Write(proof.data(), proof.size()).Write(commitment.data(), commitment.size()).Finalize(entry.begin());
77+
hasher.Write(proof.data(), proof.size()).Write(commitment.data(), commitment.size()).Write(asset_commitment.data(), asset_commitment.size()).Write(scriptPubKey.data(), scriptPubKey.size()).Finalize(entry.begin());
7878
}
7979
void ComputeEntrySurjectionProof(uint256& entry, const uint256 &hash, const std::vector<unsigned char>& proof, const std::vector<unsigned char>& commitment) {
8080
CSHA256 hasher = m_salted_hasher_surjection_proof;
@@ -176,7 +176,7 @@ void InitSurjectionproofCache()
176176
bool CachingRangeProofChecker::VerifyRangeProof(const std::vector<unsigned char>& vchRangeProof, const std::vector<unsigned char>& vchValueCommitment, const std::vector<unsigned char>& vchAssetCommitment, const CScript& scriptPubKey, const secp256k1_context* secp256k1_ctx_verify_amounts) const
177177
{
178178
uint256 entry;
179-
rangeProofCache.ComputeEntryRangeProof(entry, vchRangeProof, vchValueCommitment);
179+
rangeProofCache.ComputeEntryRangeProof(entry, vchRangeProof, vchValueCommitment, vchAssetCommitment, scriptPubKey);
180180

181181
if (rangeProofCache.Get(entry, !store)) {
182182
return true;

0 commit comments

Comments
 (0)