Skip to content

Commit

Permalink
Set issuing time after BlockIssuance api in CreateValidationBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrvivian committed May 10, 2024
1 parent b5fbc47 commit 5b08a48
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/testsuite/mock/blockissuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@ func (i *BlockIssuer) Address() iotago.Address {
func (i *BlockIssuer) CreateValidationBlock(ctx context.Context, alias string, node *Node, opts ...options.Option[ValidationBlockParams]) (*blocks.Block, error) {
blockParams := options.Apply(NewValidationBlockParams(), opts)

blockIssuanceInfo, err := i.Client.BlockIssuance(ctx)
require.NoError(i.Testing, err)

if blockParams.BlockHeader.IssuingTime == nil {
issuingTime := time.Now().UTC()
blockParams.BlockHeader.IssuingTime = &issuingTime
}

apiForBlock := i.retrieveAPI(blockParams.BlockHeader)
protoParams := apiForBlock.ProtocolParameters()
blockIssuanceInfo, err := i.Client.BlockIssuance(ctx)
require.NoError(i.Testing, err)

if blockParams.BlockHeader.SlotCommitment == nil {
commitment := blockIssuanceInfo.LatestCommitment
blockSlot := apiForBlock.TimeProvider().SlotFromTime(*blockParams.BlockHeader.IssuingTime)
Expand Down

0 comments on commit 5b08a48

Please sign in to comment.