From e02379d907b79417eedfc3873beadbbe003f1ba9 Mon Sep 17 00:00:00 2001 From: Salvatore Ingala <6681844+bigspider@users.noreply.github.com> Date: Fri, 10 Jan 2025 13:28:39 +0100 Subject: [PATCH] musigsession_commit: cleanup, just check for non-zero id instead of the whole struct; improve comment --- src/musig/musig_sessions.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/musig/musig_sessions.c b/src/musig/musig_sessions.c index 60bd10fb..b92f6269 100644 --- a/src/musig/musig_sessions.c +++ b/src/musig/musig_sessions.c @@ -132,12 +132,12 @@ const musig_psbt_session_t *musigsession_round2_initialize( void musigsession_commit(musig_signing_state_t *musig_signing_state) { uint8_t acc = 0; - for (size_t i = 0; i < sizeof(musig_signing_state->_round1); i++) { + for (size_t i = 0; i < sizeof(musig_signing_state->_round1._id); i++) { acc |= musig_signing_state->_round1._id[i]; } // If round 1 was not executed, then there is nothing to store. - // This assumes that musigsession_initialize_signing_state, therefore the field is zeroed out - // if it wasn't used. + // This assumes that musigsession_initialize_signing_state zeroes the id, therefore the field is + // zeroed out if and only if it wasn't used. if (acc != 0) { musigsession_store(musig_signing_state->_round1._id, &musig_signing_state->_round1); }