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

Function VerifyBlindValueProof

src/blindpsbt.cpp:191–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191bool VerifyBlindValueProof(CAmount value, const CConfidentialValue& conf_value, const std::vector<unsigned char>& proof, const CConfidentialAsset& conf_asset)
192{
193 if (conf_value.IsNull() || conf_asset.IsNull()) {
194 return false;
195 }
196
197 secp256k1_pedersen_commitment value_commit;
198 if (secp256k1_pedersen_commitment_parse(secp256k1_blind_context, &value_commit, conf_value.vchCommitment.data()) == 0) {
199 return false;
200 }
201
202 secp256k1_generator gen;
203 if (secp256k1_generator_parse(secp256k1_blind_context, &gen, conf_asset.vchCommitment.data()) == 0) {
204 return false;
205 }
206
207 uint64_t min_value;
208 uint64_t max_value;
209 if (secp256k1_rangeproof_verify(secp256k1_blind_context, &min_value, &max_value, &value_commit, proof.data(), proof.size(), /* extra_commit */ nullptr, /* extra_commit_len */ 0, &gen) == 0) {
210 return false;
211 }
212 return min_value == (uint64_t)value;
213}
214
215BlindProofResult VerifyBlindProofs(const PSBTOutput& o) {
216 // No blinding, no problem

Callers 2

VerifyBlindProofsFunction · 0.85
GetUnsignedTxMethod · 0.85

Calls 6

IsNullMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected