mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
simplify rangeproof validation caching
This commit is contained in:
parent
92871c6231
commit
9572165238
1 changed files with 6 additions and 2 deletions
|
|
@ -63,6 +63,11 @@ public:
|
|||
CSHA256().Write(nonce.begin(), 32).Write(hash.begin(), 32).Write(&pubkey[0], pubkey.size()).Write(&vchSig[0], vchSig.size()).Write(&vchCommitment[0], vchCommitment.size()).Write(&scriptPubKey[0], scriptPubKey.size()).Finalize(entry.begin());
|
||||
}
|
||||
|
||||
void ComputeEntry(uint256& entry, const std::vector<unsigned char>& proof, const std::vector<unsigned char>& commitment)
|
||||
{
|
||||
CSHA256().Write(nonce.begin(), nonce.size()).Write(proof.data(), proof.size()).Write(commitment.data(), commitment.size()).Finalize(entry.begin());
|
||||
}
|
||||
|
||||
bool
|
||||
Get(const uint256& entry, const bool erase)
|
||||
{
|
||||
|
|
@ -145,9 +150,8 @@ bool CachingTransactionSignatureChecker::VerifySignature(const std::vector<unsig
|
|||
|
||||
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
|
||||
{
|
||||
CPubKey pubkey(vchValueCommitment);
|
||||
uint256 entry;
|
||||
rangeProofCache.ComputeEntry(entry, uint256(), vchRangeProof, pubkey, vchAssetCommitment, scriptPubKey);
|
||||
rangeProofCache.ComputeEntry(entry, vchRangeProof, vchValueCommitment);
|
||||
|
||||
if (rangeProofCache.Get(entry, !store)) {
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue