From 41af738c1bd29f5ff51a26732315aca763bd0d58 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 22 Sep 2020 19:21:12 +0300 Subject: [PATCH] state: drop (*NEP5TransferLog).DecodeBinaryReturnCount It's no longer needed. --- pkg/core/state/nep5.go | 6 ------ pkg/core/state/nep5_test.go | 13 ------------- 2 files changed, 19 deletions(-) diff --git a/pkg/core/state/nep5.go b/pkg/core/state/nep5.go index c9ea445ba..84fcb07b6 100644 --- a/pkg/core/state/nep5.go +++ b/pkg/core/state/nep5.go @@ -160,11 +160,6 @@ func (t *NEP5Transfer) EncodeBinary(w *io.BinWriter) { // DecodeBinary implements io.Serializable interface. func (t *NEP5Transfer) DecodeBinary(r *io.BinReader) { - _ = t.DecodeBinaryReturnCount(r) -} - -// DecodeBinaryReturnCount decodes NEP5Transfer and returns the number of bytes read. -func (t *NEP5Transfer) DecodeBinaryReturnCount(r *io.BinReader) int { t.Asset = int32(r.ReadU32LE()) r.ReadBytes(t.Tx[:]) r.ReadBytes(t.From[:]) @@ -173,5 +168,4 @@ func (t *NEP5Transfer) DecodeBinaryReturnCount(r *io.BinReader) int { t.Timestamp = r.ReadU64LE() amount := r.ReadVarBytes(bigint.MaxBytesLen) t.Amount = *bigint.FromBytes(amount) - return 4 + util.Uint160Size*2 + 8 + 4 + (io.GetVarSize(len(amount)) + len(amount)) + +util.Uint256Size } diff --git a/pkg/core/state/nep5_test.go b/pkg/core/state/nep5_test.go index c7c01cbe7..41734c58c 100644 --- a/pkg/core/state/nep5_test.go +++ b/pkg/core/state/nep5_test.go @@ -8,7 +8,6 @@ import ( "github.com/nspcc-dev/neo-go/pkg/internal/random" "github.com/nspcc-dev/neo-go/pkg/internal/testserdes" - "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/stretchr/testify/require" ) @@ -62,18 +61,6 @@ func TestNEP5Transfer_DecodeBinary(t *testing.T) { testserdes.EncodeDecodeBinary(t, expected, new(NEP5Transfer)) } -func TestNEP5TransferSize(t *testing.T) { - tr := randomTransfer(rand.New(rand.NewSource(0))) - size := io.GetVarSize(tr) - w := io.NewBufBinWriter() - tr.EncodeBinary(w.BinWriter) - require.NoError(t, w.Err) - r := io.NewBinReaderFromBuf(w.Bytes()) - actualTr := &NEP5Transfer{} - actual := actualTr.DecodeBinaryReturnCount(r) - require.EqualValues(t, actual, size) -} - func randomTransfer(r *rand.Rand) *NEP5Transfer { return &NEP5Transfer{ Amount: *big.NewInt(int64(r.Uint64())),