mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-15 09:07:49 +00:00
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package payload
|
|
|
|
import (
|
|
"math/rand"
|
|
"testing"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
|
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
|
"github.com/nspcc-dev/neo-go/pkg/internal/random"
|
|
"github.com/nspcc-dev/neo-go/pkg/internal/testserdes"
|
|
)
|
|
|
|
func TestStateRoots_Serializable(t *testing.T) {
|
|
expected := &StateRoots{
|
|
Roots: []state.MPTRoot{
|
|
{
|
|
MPTRootBase: state.MPTRootBase{
|
|
Index: rand.Uint32(),
|
|
PrevHash: random.Uint256(),
|
|
Root: random.Uint256(),
|
|
},
|
|
Witness: &transaction.Witness{
|
|
InvocationScript: random.Bytes(10),
|
|
VerificationScript: random.Bytes(11),
|
|
},
|
|
},
|
|
{
|
|
MPTRootBase: state.MPTRootBase{
|
|
Index: rand.Uint32(),
|
|
PrevHash: random.Uint256(),
|
|
Root: random.Uint256(),
|
|
},
|
|
Witness: &transaction.Witness{
|
|
InvocationScript: random.Bytes(10),
|
|
VerificationScript: random.Bytes(11),
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
testserdes.EncodeDecodeBinary(t, expected, new(StateRoots))
|
|
}
|
|
|
|
func TestGetStateRoots_Serializable(t *testing.T) {
|
|
expected := &GetStateRoots{
|
|
Start: rand.Uint32(),
|
|
Count: rand.Uint32(),
|
|
}
|
|
|
|
testserdes.EncodeDecodeBinary(t, expected, new(GetStateRoots))
|
|
}
|