Skip to content

Commit 50404af

Browse files
committed
Properly serialize surjection proof in caching checker
1 parent 7f63517 commit 50404af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/script/sigcache.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ bool CachingSurjectionProofChecker::VerifySurjectionProof(secp256k1_surjectionpr
202202

203203
// Serialize proof
204204
std::vector<unsigned char> vchproof;
205-
size_t proof_len = 0;
206-
vchproof.resize(secp256k1_surjectionproof_serialized_size(secp256k1_ctx_verify_amounts, &proof));
207-
secp256k1_surjectionproof_serialize(secp256k1_ctx_verify_amounts, &vchproof[0], &proof_len, &proof);
205+
size_t proof_len = secp256k1_surjectionproof_serialized_size(secp256k1_ctx_verify_amounts, &proof);
206+
vchproof.resize(proof_len);
207+
assert(secp256k1_surjectionproof_serialize(secp256k1_ctx_verify_amounts, &vchproof[0], &proof_len, &proof) == 1);
208208

209209
// wtxid commits to all data including surj targets
210210
// we need to specify the proof and output asset point to be unique

0 commit comments

Comments
 (0)