Skip to content

Commit 35c3ecf

Browse files
authored
fix(gossip): return after sending NACK on private data store failure (#5422)
When StorePvtData fails inside privateDataMessage, a NACK is sent via msg.Ack(err) but the function continues executing due to a missing return statement. This causes two problems: 1. msg.Ack(nil) is called unconditionally right after, sending a false success ACK to the sender even though the storage failed. 2. The debug log "Private data for collection X has been stored" is printed even when the data was not actually stored, which is misleading for operators trying to diagnose private data issues. Adding an explicit return after the NACK ensures the function exits on error and only reaches msg.Ack(nil) and the success log on the happy path. Signed-off-by: Shridhar Panigrahi <sridharpanigrahi2006@gmail.com>
1 parent b16bb17 commit 35c3ecf

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

gossip/state/state.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ func (s *GossipStateProviderImpl) privateDataMessage(msg protoext.ReceivedMessag
364364
if err := s.ledger.StorePvtData(txID, txPvtRwSetWithConfig, pvtDataMsg.Payload.PrivateSimHeight); err != nil {
365365
s.logger.Errorf("Wasn't able to persist private data for collection %s, due to %s", collectionName, err)
366366
msg.Ack(err) // Sending NACK to indicate failure of storing collection
367+
return
367368
}
368369

369370
msg.Ack(nil)

0 commit comments

Comments
 (0)