From 5c0e7b17e9f345572cf48faf264ea05b8e60944f Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Thu, 27 Feb 2025 10:40:44 -0500 Subject: [PATCH] fix(protocol): preallocate return struct Signed-off-by: Chris Gianelloni --- protocol/state.go | 2 +- protocol/txsubmission/server.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/state.go b/protocol/state.go index c0fc7c95..2d8373a8 100644 --- a/protocol/state.go +++ b/protocol/state.go @@ -27,7 +27,7 @@ const ( AgencyServer ProtocolStateAgency = 2 // Server agency ) -// State represents protocol state with both a numeric ID and a string identifer +// State represents protocol state with both a numeric ID and a string identifier type State struct { Id uint Name string diff --git a/protocol/txsubmission/server.go b/protocol/txsubmission/server.go index 2924d5fe..23a52889 100644 --- a/protocol/txsubmission/server.go +++ b/protocol/txsubmission/server.go @@ -122,7 +122,7 @@ func (s *Server) RequestTxIds( // RequestTxs requests the content of the requested TX identifiers from the remote node's mempool func (s *Server) RequestTxs(txIds []TxId) ([]TxBody, error) { - var txString []string + txString := []string{} for _, t := range txIds { ba := []byte{} for _, b := range t.TxId {