From 50404afa1d807b966370e7c8984a03a04b1a2f20 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Mon, 18 Feb 2019 09:09:50 -0500 Subject: [PATCH] Properly serialize surjection proof in caching checker --- src/script/sigcache.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/script/sigcache.cpp b/src/script/sigcache.cpp index 9191c8cd42..3d67b4fa61 100644 --- a/src/script/sigcache.cpp +++ b/src/script/sigcache.cpp @@ -202,9 +202,9 @@ bool CachingSurjectionProofChecker::VerifySurjectionProof(secp256k1_surjectionpr // Serialize proof std::vector vchproof; - size_t proof_len = 0; - vchproof.resize(secp256k1_surjectionproof_serialized_size(secp256k1_ctx_verify_amounts, &proof)); - secp256k1_surjectionproof_serialize(secp256k1_ctx_verify_amounts, &vchproof[0], &proof_len, &proof); + size_t proof_len = secp256k1_surjectionproof_serialized_size(secp256k1_ctx_verify_amounts, &proof); + vchproof.resize(proof_len); + assert(secp256k1_surjectionproof_serialize(secp256k1_ctx_verify_amounts, &vchproof[0], &proof_len, &proof) == 1); // wtxid commits to all data including surj targets // we need to specify the proof and output asset point to be unique