From acaf83cebf67214eb4e49ec10e5933881fdd2807 Mon Sep 17 00:00:00 2001 From: Julian Toledano Date: Fri, 3 May 2024 13:08:08 +0200 Subject: [PATCH] fix --- client_online.go | 4 ++-- converter.go | 4 ++-- converter_test.go | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client_online.go b/client_online.go index 5ab237d..11c1b08 100644 --- a/client_online.go +++ b/client_online.go @@ -496,7 +496,7 @@ func (c *Client) blockTxs(ctx context.Context, height *int64) (crgtypes.BlockTra return crgtypes.BlockTransactionsResponse{}, crgerrs.WrapError(crgerrs.ErrOnlineClient, "block results transactions do now match block transactions") } // process begin and end block txs - FinalizeBlockTx := &rosettatypes.Transaction{ + finalizeBlockTx := &rosettatypes.Transaction{ TransactionIdentifier: &rosettatypes.TransactionIdentifier{Hash: c.converter.ToRosetta().FinalizeBlockTxHash(blockInfo.BlockID.Hash)}, Operations: AddOperationIndexes( nil, @@ -516,7 +516,7 @@ func (c *Client) blockTxs(ctx context.Context, height *int64) (crgtypes.BlockTra finalTxs := make([]*rosettatypes.Transaction, 0, 1+len(deliverTx)) finalTxs = append(finalTxs, deliverTx...) - finalTxs = append(finalTxs, FinalizeBlockTx) + finalTxs = append(finalTxs, finalizeBlockTx) return crgtypes.BlockTransactionsResponse{ BlockResponse: c.converter.ToRosetta().BlockResponse(blockInfo), diff --git a/converter.go b/converter.go index 4456c66..a10628b 100644 --- a/converter.go +++ b/converter.go @@ -473,8 +473,8 @@ func AddOperationIndexes(msgOps, balanceOps []*rosettatypes.Operation) (finalOps } // FinalizeBlockTxHash produces a mock beginblock hash that rosetta can query -// for beginblock operations, it also serves the purpose of representing -// part of the state changes happening at beginblock level (balance ones) +// for finalizeBlock operations, it also serves the purpose of representing +// part of the state changes happening at finalizeblock level (balance ones) func (c converter) FinalizeBlockTxHash(hash []byte) string { final := append([]byte{FinalizeBlockHashStart}, hash...) return fmt.Sprintf("%X", final) diff --git a/converter_test.go b/converter_test.go index 8ef1655..2594b8c 100644 --- a/converter_test.go +++ b/converter_test.go @@ -179,23 +179,23 @@ func (s *ConverterTestSuite) TestOpsAndSigners() { }) } -func (s *ConverterTestSuite) TestBeginEndBlockAndHashToTxType() { +func (s *ConverterTestSuite) TestFinalizeBlockHashToTxType() { const deliverTxHex = "5229A67AA008B5C5F1A0AEA77D4DEBE146297A30AAEF01777AF10FAD62DD36AB" deliverTxBytes, err := hex.DecodeString(deliverTxHex) s.Require().NoError(err) - endBlockTxHex := s.c.ToRosetta().FinalizeBlockTxHash(deliverTxBytes) + finalizeBlockTxHex := s.c.ToRosetta().FinalizeBlockTxHash(deliverTxBytes) txType, hash := s.c.ToSDK().HashToTxType(deliverTxBytes) s.Require().Equal(rosetta.DeliverTxTx, txType) s.Require().Equal(deliverTxBytes, hash, "deliver tx hash should not change") - endBlockTxBytes, err := hex.DecodeString(endBlockTxHex) + finalizeBlockTxBytes, err := hex.DecodeString(finalizeBlockTxHex) s.Require().NoError(err) - txType, hash = s.c.ToSDK().HashToTxType(endBlockTxBytes) + txType, hash = s.c.ToSDK().HashToTxType(finalizeBlockTxBytes) s.Require().Equal(rosetta.FinalizeBlockTx, txType) s.Require().Equal(deliverTxBytes, hash, "end block tx hash should be equal to a block hash")