Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cmd/gouroboros/chainsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,17 +279,19 @@ func chainSyncRollForwardHandler(
case ledger.BlockTypeByronEbb:
byronEbbBlock := block.(*ledger.ByronEpochBoundaryBlock)
fmt.Printf(
"era = Byron (EBB), epoch = %d, slot = %d, id = %s\n",
"era = Byron (EBB), epoch = %d, slot = %d, block_no = %d, id = %s\n",
byronEbbBlock.BlockHeader.ConsensusData.Epoch,
byronEbbBlock.SlotNumber(),
byronEbbBlock.BlockNumber(),
byronEbbBlock.Hash(),
)
case ledger.BlockTypeByronMain:
byronBlock := block.(*ledger.ByronMainBlock)
fmt.Printf(
"era = Byron, epoch = %d, slot = %d, id = %s\n",
"era = Byron, epoch = %d, slot = %d, block_no = %d, id = %s\n",
byronBlock.BlockHeader.ConsensusData.SlotId.Epoch,
byronBlock.SlotNumber(),
byronBlock.BlockNumber(),
byronBlock.Hash(),
)
default:
Expand All @@ -314,9 +316,9 @@ func blockFetchBlockHandler(
) error {
switch block := blockData.(type) {
case *ledger.ByronEpochBoundaryBlock:
fmt.Printf("era = Byron (EBB), epoch = %d, slot = %d, id = %s\n", block.BlockHeader.ConsensusData.Epoch, block.SlotNumber(), block.Hash())
fmt.Printf("era = Byron (EBB), epoch = %d, slot = %d, block_no = %d, id = %s\n", block.BlockHeader.ConsensusData.Epoch, block.SlotNumber(), block.BlockNumber(), block.Hash())
case *ledger.ByronMainBlock:
fmt.Printf("era = Byron, epoch = %d, slot = %d, id = %s\n", block.BlockHeader.ConsensusData.SlotId.Epoch, block.SlotNumber(), block.Hash())
fmt.Printf("era = Byron, epoch = %d, slot = %d, block_no = %d, id = %s\n", block.BlockHeader.ConsensusData.SlotId.Epoch, block.SlotNumber(), block.BlockNumber(), block.Hash())
case ledger.Block:
fmt.Printf("era = %s, slot = %d, block_no = %d, id = %s\n", block.Era().Name, block.SlotNumber(), block.BlockNumber(), block.Hash())
}
Expand Down
8 changes: 3 additions & 5 deletions ledger/byron/byron.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type ByronMainBlockHeader struct {
PubKey []byte
Difficulty struct {
cbor.StructAsArray
Unknown uint64
Value uint64
}
BlockSig []interface{}
}
Expand Down Expand Up @@ -105,8 +105,7 @@ func (h *ByronMainBlockHeader) PrevHash() string {
}

func (h *ByronMainBlockHeader) BlockNumber() uint64 {
// Byron blocks don't store the block number in the block
return 0
return h.ConsensusData.Difficulty.Value
}

func (h *ByronMainBlockHeader) SlotNumber() uint64 {
Expand Down Expand Up @@ -538,8 +537,7 @@ func (h *ByronEpochBoundaryBlockHeader) PrevHash() string {
}

func (h *ByronEpochBoundaryBlockHeader) BlockNumber() uint64 {
// Byron blocks don't store the block number in the block
return 0
return h.ConsensusData.Difficulty.Value
}

func (h *ByronEpochBoundaryBlockHeader) SlotNumber() uint64 {
Expand Down
Loading