From a11df60d281baa1300132fe54eda6b14015bef42 Mon Sep 17 00:00:00 2001 From: 0xluk Date: Thu, 5 Sep 2024 14:52:55 +0300 Subject: [PATCH] return moneyFlew false for tx that does not have a status in getTransactionInfo --- rpc/rpc_server.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/rpc/rpc_server.go b/rpc/rpc_server.go index c6ad93e..cd016d4 100644 --- a/rpc/rpc_server.go +++ b/rpc/rpc_server.go @@ -54,15 +54,21 @@ func NewServer(listenAddrGRPC, listenAddrHTTP string, syncThreshold int, chainTi } func getTransactionInfo(ctx context.Context, pebbleStore *store.PebbleStore, transactionId string, tickNumber uint32) (*TransactionInfo, error) { - - txStatus, err := pebbleStore.GetTransactionStatus(ctx, transactionId) + tickData, err := pebbleStore.GetTickData(ctx, tickNumber) if err != nil { - return nil, errors.Wrap(err, "getting transaction status") + return nil, errors.Wrap(err, "getting tick data") } - tickData, err := pebbleStore.GetTickData(ctx, tickNumber) + txStatus, err := pebbleStore.GetTransactionStatus(ctx, transactionId) if err != nil { - return nil, errors.Wrap(err, "getting tick data") + if errors.Is(err, store.ErrNotFound) { + return &TransactionInfo{ + timestamp: tickData.Timestamp, + moneyFlew: false, + }, nil + } + + return nil, errors.Wrap(err, "getting transaction status") } return &TransactionInfo{