From 7edc0d5656a9be18632b6feab048c9f65ac5ef37 Mon Sep 17 00:00:00 2001 From: Piotr Macek <4007944+piotrm50@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:11:54 +0200 Subject: [PATCH] Fix block serialization. --- block_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/block_test.go b/block_test.go index 899e5d36e..cc9dc23ae 100644 --- a/block_test.go +++ b/block_test.go @@ -9,7 +9,6 @@ import ( "github.com/iotaledger/hive.go/lo" "github.com/iotaledger/hive.go/serializer/v2" "github.com/iotaledger/hive.go/serializer/v2/serix" - "github.com/iotaledger/iota-core/pkg/model" iotago "github.com/iotaledger/iota.go/v4" "github.com/iotaledger/iota.go/v4/api" "github.com/iotaledger/iota.go/v4/builder" @@ -52,16 +51,16 @@ func TestBlock_DeSerialize(t *testing.T) { } func createBlockAtSlotWithVersion(t *testing.T, index iotago.SlotIndex, version iotago.Version, apiProvider *api.EpochBasedProvider) error { - api := apiProvider.APIForSlot(index) - block, err := builder.NewBasicBlockBuilder(api). + apiForSlot := apiProvider.APIForSlot(index) + block, err := builder.NewBasicBlockBuilder(apiForSlot). ProtocolVersion(version). StrongParents(iotago.BlockIDs{iotago.BlockID{}}). - IssuingTime(api.TimeProvider().SlotStartTime(index)). - SlotCommitmentID(iotago.NewCommitment(api.Version(), index-api.ProtocolParameters().MinCommittableAge(), iotago.CommitmentID{}, iotago.Identifier{}, 0).MustID()). + IssuingTime(apiForSlot.TimeProvider().SlotStartTime(index)). + SlotCommitmentID(iotago.NewCommitment(apiForSlot.Version(), index-apiForSlot.ProtocolParameters().MinCommittableAge(), iotago.CommitmentID{}, iotago.Identifier{}, 0).MustID()). Build() require.NoError(t, err) - return lo.Return2(model.BlockFromBlock(block, api, serix.WithValidation())) + return lo.Return2(apiForSlot.Encode(block, serix.WithValidation())) } func TestProtocolBlock_ProtocolVersionSyntactical(t *testing.T) {