@@ -163,29 +163,31 @@ func NewMetadataShard(ctx context.Context, opts MetadataShardOpts) (*MetadataSha
163163
164164 go func () {
165165 <- ctx .Done ()
166- shard .node .Stop ()
166+ if err := shard .node .Stop (); err != nil {
167+ shard .log .Default .Warnw ("failed to stop cometbft node" , "err" , err )
168+ }
167169 }()
168170
169171 return shard , nil
170172}
171173
172- func (s * MetadataShard ) Stopped () <- chan struct {} {
173- return s .node .Quit ()
174+ func (m * MetadataShard ) Stopped () <- chan struct {} {
175+ return m .node .Quit ()
174176}
175177
176- func (s * MetadataShard ) SubmitTx (tx []byte ) error {
177- if s .node == nil {
178+ func (m * MetadataShard ) SubmitTx (tx []byte ) error {
179+ if m .node == nil {
178180 return RiverError (Err_FAILED_PRECONDITION , "metadata shard not started" )
179181 }
180- _ , err := s .node .Mempool ().CheckTx (tx , "" )
182+ _ , err := m .node .Mempool ().CheckTx (tx , "" )
181183 return err
182184}
183185
184- func (s * MetadataShard ) Height () int64 {
185- if s .node == nil {
186+ func (m * MetadataShard ) Height () int64 {
187+ if m .node == nil {
186188 return 0
187189 }
188- return s .node .BlockStore ().Height ()
190+ return m .node .BlockStore ().Height ()
189191}
190192
191193func chainIDForShard (shardID uint64 ) string {
@@ -373,9 +375,7 @@ func (m *MetadataShard) Query(ctx context.Context, req *abci.QueryRequest) (*abc
373375 resp .Value = payload
374376 case strings .HasPrefix (parsedPath .Path , "/streams/node/" ):
375377 addrHex := strings .TrimPrefix (parsedPath .Path , "/streams/node/" )
376- if strings .HasPrefix (addrHex , "0x" ) {
377- addrHex = addrHex [2 :]
378- }
378+ addrHex = strings .TrimPrefix (addrHex , "0x" )
379379 if len (addrHex ) != 40 {
380380 setError (resp , RiverError (Err_INVALID_ARGUMENT , "node address must be 20 bytes hex" ))
381381 return resp , nil
@@ -428,9 +428,7 @@ func (m *MetadataShard) Query(ctx context.Context, req *abci.QueryRequest) (*abc
428428 resp .Value = payload
429429 case strings .HasPrefix (parsedPath .Path , "/streams/count/" ):
430430 addrHex := strings .TrimPrefix (parsedPath .Path , "/streams/count/" )
431- if strings .HasPrefix (addrHex , "0x" ) {
432- addrHex = addrHex [2 :]
433- }
431+ addrHex = strings .TrimPrefix (addrHex , "0x" )
434432 if len (addrHex ) != 40 {
435433 setError (resp , RiverError (Err_INVALID_ARGUMENT , "node address must be 20 bytes hex" ))
436434 return resp , nil
@@ -474,22 +472,22 @@ func (m *MetadataShard) InitChain(ctx context.Context, req *abci.InitChainReques
474472 }, nil
475473}
476474
477- func (MetadataShard ) ListSnapshots (context.Context , * abci.ListSnapshotsRequest ) (* abci.ListSnapshotsResponse , error ) {
475+ func (m * MetadataShard ) ListSnapshots (context.Context , * abci.ListSnapshotsRequest ) (* abci.ListSnapshotsResponse , error ) {
478476 return & abci.ListSnapshotsResponse {}, nil
479477}
480478
481- func (MetadataShard ) OfferSnapshot (context.Context , * abci.OfferSnapshotRequest ) (* abci.OfferSnapshotResponse , error ) {
479+ func (m * MetadataShard ) OfferSnapshot (context.Context , * abci.OfferSnapshotRequest ) (* abci.OfferSnapshotResponse , error ) {
482480 return & abci.OfferSnapshotResponse {}, nil
483481}
484482
485- func (MetadataShard ) LoadSnapshotChunk (
483+ func (m * MetadataShard ) LoadSnapshotChunk (
486484 context.Context ,
487485 * abci.LoadSnapshotChunkRequest ,
488486) (* abci.LoadSnapshotChunkResponse , error ) {
489487 return & abci.LoadSnapshotChunkResponse {}, nil
490488}
491489
492- func (MetadataShard ) ApplySnapshotChunk (
490+ func (m * MetadataShard ) ApplySnapshotChunk (
493491 context.Context ,
494492 * abci.ApplySnapshotChunkRequest ,
495493) (* abci.ApplySnapshotChunkResponse , error ) {
0 commit comments