Skip to content

Commit

Permalink
Fix trace pending txns
Browse files Browse the repository at this point in the history
Co-authored-by: IronGauntlets <aneeque@nethermind.io>
  • Loading branch information
wojciechos and IronGauntlets committed Jan 17, 2025
1 parent 0c9ee5a commit fe1040c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rpc/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/NethermindEth/juno/blockchain"
"github.com/NethermindEth/juno/core"
"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/juno/db"
"github.com/NethermindEth/juno/jsonrpc"
"github.com/NethermindEth/juno/starknet"
"github.com/NethermindEth/juno/sync"
Expand Down Expand Up @@ -141,7 +142,7 @@ func (h *Handler) traceTransaction(ctx context.Context, hash *felt.Felt) (*vm.Tr
httpHeader := http.Header{}
httpHeader.Set(ExecutionStepsHeader, "0")

if err != nil {
if err != nil && !errors.Is(err, db.ErrKeyNotFound) {
return nil, httpHeader, ErrTxnHashNotFound
}

Expand Down
1 change: 1 addition & 0 deletions rpc/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func TestTraceTransaction(t *testing.T) {
hash := utils.HexToFelt(t, "0xBBBB")
// Receipt() returns error related to db
mockReader.EXPECT().Receipt(hash).Return(nil, nil, uint64(0), db.ErrKeyNotFound)
mockSyncReader.EXPECT().Pending().Return(&sync.Pending{Block: &core.Block{}}, nil)

trace, httpHeader, err := handler.TraceTransaction(context.Background(), *hash)
assert.Nil(t, trace)
Expand Down

0 comments on commit fe1040c

Please sign in to comment.