From b6175958eedf5ba4707dbbf52f04308abea548a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Nowosielski?= Date: Mon, 28 Oct 2024 20:29:02 +0100 Subject: [PATCH] Han's comments --- rpc/events.go | 3 +++ rpc/handlers.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/rpc/events.go b/rpc/events.go index 15f8d06b2e..06f998e151 100644 --- a/rpc/events.go +++ b/rpc/events.go @@ -372,6 +372,9 @@ func (h *Handler) sendReorg(w jsonrpc.Conn, reorg *sync.ReorgData, id uint64) er return err } +// SubscribeTxnStatus subscribes to status changes of a transaction. It checks for updates each time a new block is added. +// Subsequent updates are sent only when the transaction status changes. +// The optional block_id parameter is ignored, as status changes are not stored and historical data cannot be sent. func (h *Handler) SubscribeTxnStatus(ctx context.Context, txHash felt.Felt, _ *BlockID) (*SubscriptionID, *jsonrpc.Error) { var ( lastKnownStatus, lastSendStatus *TransactionStatus diff --git a/rpc/handlers.go b/rpc/handlers.go index 68fa77f9a1..9cd1268c5e 100644 --- a/rpc/handlers.go +++ b/rpc/handlers.go @@ -339,7 +339,7 @@ func (h *Handler) Methods() ([]jsonrpc.Method, string) { //nolint: funlen }, { Name: "starknet_subscribeTransactionStatus", - Params: []jsonrpc.Parameter{{Name: "transaction_hash"}, {Name: "block"}}, + Params: []jsonrpc.Parameter{{Name: "transaction_hash"}, {Name: "block", Optional: true}}, Handler: h.SubscribeTxnStatus, }, {