diff --git a/src/blind.cpp b/src/blind.cpp index 367e6566ea..7d92deea9d 100644 --- a/src/blind.cpp +++ b/src/blind.cpp @@ -217,8 +217,9 @@ int BlindOutputs(std::vector& input_blinding_factors, const std::vecto CKey ephemeral_key; ephemeral_key.MakeNewKey(true); CPubKey ephemeral_pubkey = ephemeral_key.GetPubKey(); - out.nNonce.vchCommitment.resize(33); - memcpy(&out.nNonce.vchCommitment[0], &ephemeral_pubkey[0], 33); + assert(ephemeral_pubkey.size() == CConfidentialNonce::nCommittedSize); + out.nNonce.vchCommitment.resize(ephemeral_pubkey.size()); + memcpy(&out.nNonce.vchCommitment[0], &ephemeral_pubkey[0], ephemeral_pubkey.size()); // Generate nonce uint256 nonce = ephemeral_key.ECDH(output_pubkeys[nOut]); CSHA256().Write(nonce.begin(), 32).Finalize(nonce.begin());