Skip to content

Commit a5dd337

Browse files
authored
Fix error message when signing with duplicate tx_id (Issue #60) (#63)
* Fix error message when signing with duplicate tx id * Update error message for duplicate signing requests to be more concise
1 parent 372f9e2 commit a5dd337

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

pkg/event/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ func GetErrorCodeFromError(err error) ErrorCode {
137137
return ErrorCodeContextCancelled
138138
case contains(errStr, "invalid signature from initiator"):
139139
return ErrorCodeInvalidInitiatorSignature
140+
case contains(errStr, "duplicate"):
141+
return ErrorCodeSessionDuplicate
140142
default:
141143
return ErrorCodeUnknown
142144
}

pkg/eventconsumer/event_consumer.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,15 @@ func (ec *eventConsumer) consumeTxSigningEvent() error {
323323

324324
// Check for duplicate session and track if new
325325
if ec.checkDuplicateSession(msg.WalletID, msg.TxID) {
326+
duplicateErr := fmt.Errorf("duplicate signing request detected for walletID=%s txID=%s", msg.WalletID, msg.TxID)
327+
ec.handleSigningSessionError(
328+
msg.WalletID,
329+
msg.TxID,
330+
msg.NetworkInternalCode,
331+
duplicateErr,
332+
"Duplicate session",
333+
natMsg,
334+
)
326335
return
327336
}
328337

0 commit comments

Comments
 (0)