Skip to content

Commit 8ca60c0

Browse files
authored
Fix: handle NOT_VALIDATED status in ledger.Status() (#1417)
Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
1 parent 7b45d74 commit 8ca60c0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

token/services/network/fabricx/ledger.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func NewLedger(ch *fabric.Channel, keyTranslator translator.KeyTranslator, execu
4141

4242
// Status returns the validation code of the transaction with the given ID.
4343
// It retrieves the transaction from the Fabric ledger and maps its internal
44-
// validation code to a driver.ValidationCode (Valid or Invalid).
44+
// validation code to a driver.ValidationCode (Unknown, Valid, or Invalid).
4545
func (l *ledger) Status(id string) (driver.ValidationCode, error) {
4646
tx, err := l.l.GetTransactionByID(id)
4747
if err != nil {
@@ -50,6 +50,8 @@ func (l *ledger) Status(id string) (driver.ValidationCode, error) {
5050
logger.Debugf("ledger status of [%s] is [%d]", id, tx.ValidationCode())
5151

5252
switch protoblocktx.Status(tx.ValidationCode()) {
53+
case protoblocktx.Status_NOT_VALIDATED:
54+
return driver.Unknown, nil
5355
case protoblocktx.Status_COMMITTED:
5456
return driver.Valid, nil
5557
default:

0 commit comments

Comments
 (0)