Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 84490a3

Browse files
committed
Skip serialization of sales transaction if none are in the db
1 parent aa650c7 commit 84490a3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

repo/db/sales.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,11 @@ func (s *SalesDB) GetByOrderId(orderId string) (*pb.RicardianContract, pb.OrderS
315315
return nil, pb.OrderState(0), false, nil, false, nil, fmt.Errorf("validating payment coin: %s", err.Error())
316316
}
317317
var records []*wallet.TransactionRecord
318-
err = json.Unmarshal(serializedTransactions, &records)
319-
if err != nil {
320-
log.Error(err)
318+
if len(serializedTransactions) > 0 {
319+
err = json.Unmarshal(serializedTransactions, &records)
320+
if err != nil {
321+
return nil, pb.OrderState(0), false, nil, false, nil, fmt.Errorf("unmarshal purchase transactions: %s", err.Error())
322+
}
321323
}
322324
cc := def.CurrencyCode()
323325
return rc, pb.OrderState(stateInt), funded, records, read, &cc, nil

0 commit comments

Comments
 (0)