Skip to content

Commit 794c3f1

Browse files
committed
fix: default instrument version to 1 when domain version is 0
Proto validation requires version >= 1. Domain instruments created before versioning was introduced have version 0 as default.
1 parent 969b5eb commit 794c3f1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

services/current-account/service/grpc_control_endpoints.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,14 @@ func (s *Service) publishAccountClosedEvent(
344344
accountID, reason, actorID, correlationID string,
345345
actionTimestamp, now time.Time,
346346
) error {
347+
version := int32(account.Balance().Instrument().Version)
348+
if version == 0 {
349+
version = 1
350+
}
347351
closingBalance := &quantityv1.InstrumentAmount{
348352
Amount: account.Balance().Amount().String(),
349353
InstrumentCode: account.Balance().InstrumentCode(),
350-
Version: int32(account.Balance().Instrument().Version),
354+
Version: version,
351355
}
352356
event := &eventsv1.AccountClosedEvent{
353357
EventId: uuid.New().String(),

0 commit comments

Comments
 (0)