state: drop (*NEP5TransferLog).DecodeBinaryReturnCount

It's no longer needed.
This commit is contained in:
Roman Khimov 2020-09-22 19:21:12 +03:00
parent a53bc6b13e
commit 41af738c1b
2 changed files with 0 additions and 19 deletions

View file

@ -160,11 +160,6 @@ func (t *NEP5Transfer) EncodeBinary(w *io.BinWriter) {
// DecodeBinary implements io.Serializable interface. // DecodeBinary implements io.Serializable interface.
func (t *NEP5Transfer) DecodeBinary(r *io.BinReader) { 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()) t.Asset = int32(r.ReadU32LE())
r.ReadBytes(t.Tx[:]) r.ReadBytes(t.Tx[:])
r.ReadBytes(t.From[:]) r.ReadBytes(t.From[:])
@ -173,5 +168,4 @@ func (t *NEP5Transfer) DecodeBinaryReturnCount(r *io.BinReader) int {
t.Timestamp = r.ReadU64LE() t.Timestamp = r.ReadU64LE()
amount := r.ReadVarBytes(bigint.MaxBytesLen) amount := r.ReadVarBytes(bigint.MaxBytesLen)
t.Amount = *bigint.FromBytes(amount) t.Amount = *bigint.FromBytes(amount)
return 4 + util.Uint160Size*2 + 8 + 4 + (io.GetVarSize(len(amount)) + len(amount)) + +util.Uint256Size
} }

View file

@ -8,7 +8,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/internal/random" "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/internal/testserdes"
"github.com/nspcc-dev/neo-go/pkg/io"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -62,18 +61,6 @@ func TestNEP5Transfer_DecodeBinary(t *testing.T) {
testserdes.EncodeDecodeBinary(t, expected, new(NEP5Transfer)) 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 { func randomTransfer(r *rand.Rand) *NEP5Transfer {
return &NEP5Transfer{ return &NEP5Transfer{
Amount: *big.NewInt(int64(r.Uint64())), Amount: *big.NewInt(int64(r.Uint64())),