From 5f17da4517dbcbfb4f25a874010321287fc8266c Mon Sep 17 00:00:00 2001 From: Yago Date: Wed, 4 Sep 2024 17:22:41 +0200 Subject: [PATCH 1/3] /tpool/raw reply with tx json --- node/api/transactionpool.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/node/api/transactionpool.go b/node/api/transactionpool.go index d7ad84fe2f..48c87b6390 100644 --- a/node/api/transactionpool.go +++ b/node/api/transactionpool.go @@ -39,6 +39,11 @@ type ( TpoolTxnsGET struct { Transactions []types.Transaction `json:"transactions"` } + + // TpoolRawPOST reply with tx data + TpoolRawPOST struct { + Transaction types.Transaction `json:"transaction"` + } ) // RegisterRoutesTransactionPool is a helper function to register all @@ -139,7 +144,10 @@ func tpoolRawHandlerPOST(tpool modules.TransactionPool, w http.ResponseWriter, r WriteError(w, Error{"error accepting transaction set: " + err.Error()}, http.StatusBadRequest) return } - WriteSuccess(w) + + WriteJSON(w, TpoolRawPOST{ + Transaction: txn, + }) } // tpoolConfirmedGET returns whether the specified transaction has From 2bce324fe807e149bb9caae79a4242ff12fa22f2 Mon Sep 17 00:00:00 2001 From: Yago Date: Wed, 4 Sep 2024 18:05:35 +0200 Subject: [PATCH 2/3] TX ID --- node/api/transactionpool.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/node/api/transactionpool.go b/node/api/transactionpool.go index 48c87b6390..a7c46ab023 100644 --- a/node/api/transactionpool.go +++ b/node/api/transactionpool.go @@ -40,9 +40,9 @@ type ( Transactions []types.Transaction `json:"transactions"` } - // TpoolRawPOST reply with tx data + // TpoolRawPOST reply with transaction ID TpoolRawPOST struct { - Transaction types.Transaction `json:"transaction"` + ID types.TransactionID `json:"id"` } ) @@ -146,7 +146,7 @@ func tpoolRawHandlerPOST(tpool modules.TransactionPool, w http.ResponseWriter, r } WriteJSON(w, TpoolRawPOST{ - Transaction: txn, + ID: txn.ID(), }) } From 24112a3676cd7b90ff1b0e0cf9ca465cf67d93d9 Mon Sep 17 00:00:00 2001 From: Yago Date: Wed, 4 Sep 2024 18:20:43 +0200 Subject: [PATCH 3/3] Update transactionpool.go --- node/api/transactionpool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/api/transactionpool.go b/node/api/transactionpool.go index a7c46ab023..6a73657431 100644 --- a/node/api/transactionpool.go +++ b/node/api/transactionpool.go @@ -144,7 +144,7 @@ func tpoolRawHandlerPOST(tpool modules.TransactionPool, w http.ResponseWriter, r WriteError(w, Error{"error accepting transaction set: " + err.Error()}, http.StatusBadRequest) return } - + WriteJSON(w, TpoolRawPOST{ ID: txn.ID(), })