mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-30 09:33:36 +00:00
state: drop (*NEP5TransferLog).DecodeBinaryReturnCount
It's no longer needed.
This commit is contained in:
parent
a53bc6b13e
commit
41af738c1b
2 changed files with 0 additions and 19 deletions
|
@ -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
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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())),
|
||||||
|
|
Loading…
Reference in a new issue