neoneo-go/pkg/core/spent_coin_state_test.go
Roman Khimov 0e2bda4f21 core: drop txHash from SpentCoinState
It's a key for it, makes no sense storing it as data.
2020-03-09 16:58:21 +03:00

29 lines
584 B
Go

package core
import (
"testing"
"github.com/nspcc-dev/neo-go/pkg/internal/random"
"github.com/nspcc-dev/neo-go/pkg/io"
"github.com/stretchr/testify/assert"
)
func TestEncodeDecodeSpentCoinState(t *testing.T) {
spent := &SpentCoinState{
txHeight: 1001,
items: map[uint16]uint32{
1: 3,
2: 8,
4: 100,
},
}
buf := io.NewBufBinWriter()
spent.EncodeBinary(buf.BinWriter)
assert.Nil(t, buf.Err)
spentDecode := new(SpentCoinState)
r := io.NewBinReaderFromBuf(buf.Bytes())
spentDecode.DecodeBinary(r)
assert.Nil(t, r.Err)
assert.Equal(t, spent, spentDecode)
}