MCPcopy Create free account
hub / github.com/ElementsProject/elements / VerifySurjectionProof

Method VerifySurjectionProof

src/script/sigcache.cpp:218–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218bool CachingSurjectionProofChecker::VerifySurjectionProof(secp256k1_surjectionproof& proof, std::vector<secp256k1_generator>& vTags, secp256k1_generator& gen, const secp256k1_context* secp256k1_ctx_verify_amounts, const uint256& wtxid) const
219{
220
221 // Serialize proof
222 std::vector<unsigned char> vchproof;
223 size_t proof_len = secp256k1_surjectionproof_serialized_size(secp256k1_ctx_verify_amounts, &proof);
224 vchproof.resize(proof_len);
225 assert(secp256k1_surjectionproof_serialize(secp256k1_ctx_verify_amounts, vchproof.data(), &proof_len, &proof) == 1);
226
227 // wtxid commits to all data including surj targets
228 // we need to specify the proof and output asset point to be unique
229 uint256 entry;
230 surjectionProofCache.ComputeEntrySurjectionProof(entry, wtxid, vchproof, std::vector<unsigned char>(std::begin(gen.data), std::end(gen.data)));
231
232 if (surjectionProofCache.Get(entry, !store)) {
233 return true;
234 }
235
236 if (secp256k1_surjectionproof_verify(secp256k1_ctx_verify_amounts, &proof, vTags.data(), vTags.size(), &gen) != 1) {
237 return false;
238 }
239
240 if (store) {
241 surjectionProofCache.Set(entry);
242 }
243
244 return true;
245}
246
247// END ELEMENTS
248//

Callers 1

operator()Method · 0.80

Calls 11

beginFunction · 0.85
endFunction · 0.85
resizeMethod · 0.45
dataMethod · 0.45
GetMethod · 0.45
sizeMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected