From 48f79969fe18f3f80493cc1956bc237771062497 Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Mon, 11 Mar 2024 21:30:03 +0800 Subject: [PATCH] Debug logs --- block.go | 8 ++++++-- builder/block_builder.go | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/block.go b/block.go index e36f6c4e5..bc53c3880 100644 --- a/block.go +++ b/block.go @@ -269,6 +269,7 @@ func (b *Block) ManaCost(rmc Mana) (Mana, error) { // syntacticallyValidate syntactically validates the Block. func (b *Block) syntacticallyValidate() error { + fmt.Println(">>>>>printed from iota.go", b) if b.Size() > MaxBlockSize { return ierrors.Wrapf(ErrBlockMaxSizeExceeded, "max size of a block is %d but got %d bytes", MaxBlockSize, b.Size()) } @@ -306,16 +307,19 @@ func (b *Block) syntacticallyValidate() error { return ierrors.Wrapf(err, "failed to syntactically validate block") } blockSlot := blockID.Slot() + fmt.Println(">>>from iota.go", commitmentSlot, minCommittableAge, blockSlot, genesisSlot, maxCommittableAge) + fmt.Println(">>>from iota.go", commitmentSlot+maxCommittableAge) // check that commitment is not too recent. if commitmentSlot > genesisSlot && // Don't filter commitments to genesis based on being too recent. blockSlot < commitmentSlot+minCommittableAge { - return ierrors.Wrapf(ErrCommitmentTooRecent, "block at slot %d committing to slot %d", blockSlot, b.Header.SlotCommitmentID.Slot()) + return ierrors.Wrapf(ErrCommitmentTooRecent, "block at slot %d committing to slot %d", blockSlot, commitmentSlot) } // Check that commitment is not too old. if blockSlot > commitmentSlot+maxCommittableAge { - return ierrors.Wrapf(ErrCommitmentTooOld, "block at slot %d committing to slot %d, max committable age %d", blockSlot, b.Header.SlotCommitmentID.Slot(), maxCommittableAge) + errStr := fmt.Sprintf("block at slot %d committing to slot %d, max committable age %d", blockSlot, commitmentSlot, maxCommittableAge) + return ierrors.Wrap(ErrCommitmentTooOld, errStr) } return b.Body.syntacticallyValidate(b) diff --git a/builder/block_builder.go b/builder/block_builder.go index b2697ed08..6c8b4555f 100644 --- a/builder/block_builder.go +++ b/builder/block_builder.go @@ -84,7 +84,7 @@ func (b *BasicBlockBuilder) SlotCommitmentID(commitment iotago.CommitmentID) *Ba return b } - b.protocolBlock.Header.SlotCommitmentID = commitment + copy(b.protocolBlock.Header.SlotCommitmentID[:], commitment[:]) return b } @@ -283,7 +283,7 @@ func (v *ValidationBlockBuilder) SlotCommitmentID(commitmentID iotago.Commitment return v } - v.protocolBlock.Header.SlotCommitmentID = commitmentID + copy(v.protocolBlock.Header.SlotCommitmentID[:], commitmentID[:]) return v }