Use gmsl relay_txn response type

This commit is contained in:
Devon Hudson 2023-01-31 12:31:57 -07:00
parent f98003c030
commit 7b3334778f
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628
4 changed files with 12 additions and 18 deletions

View file

@ -25,12 +25,6 @@ import (
"github.com/sirupsen/logrus"
)
type RelayTransactionResponse struct {
Transaction gomatrixserverlib.Transaction `json:"transaction"`
EntryID int64 `json:"entry_id,omitempty"`
EntriesQueued bool `json:"entries_queued"`
}
// GetTransactionFromRelay implements GET /_matrix/federation/v1/relay_txn/{userID}
// This endpoint can be extracted into a separate relay server service.
func GetTransactionFromRelay(
@ -41,7 +35,7 @@ func GetTransactionFromRelay(
) util.JSONResponse {
logrus.Infof("Processing relay_txn for %s", userID.Raw())
previousEntry := gomatrixserverlib.RelayEntry{}
var previousEntry gomatrixserverlib.RelayEntry
if err := json.Unmarshal(fedReq.Content(), &previousEntry); err != nil {
return util.JSONResponse{
Code: http.StatusInternalServerError,
@ -65,7 +59,7 @@ func GetTransactionFromRelay(
return util.JSONResponse{
Code: http.StatusOK,
JSON: RelayTransactionResponse{
JSON: gomatrixserverlib.RespGetRelayTransaction{
Transaction: response.Transaction,
EntryID: response.EntryID,
EntriesQueued: response.EntriesQueued,