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
24 changes: 5 additions & 19 deletions ledger/block.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Blink Labs Software
// Copyright 2024 Blink Labs Software
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,26 +17,12 @@ package ledger
import (
"fmt"

utxorpc "github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano"
"github.com/blinklabs-io/gouroboros/ledger/common"
)

type Block interface {
BlockHeader
Type() int
Transactions() []Transaction
Utxorpc() *utxorpc.Block
}

type BlockHeader interface {
Hash() string
PrevHash() string
BlockNumber() uint64
SlotNumber() uint64
IssuerVkey() IssuerVkey
BlockBodySize() uint64
Era() Era
Cbor() []byte
}
// Compatibility aliases
type Block = common.Block
type BlockHeader = common.BlockHeader

func NewBlockFromCbor(blockType uint, data []byte) (Block, error) {
switch blockType {
Expand Down
21 changes: 21 additions & 0 deletions ledger/common/block.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package common

import utxorpc "github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano"

type Block interface {
BlockHeader
Type() int
Transactions() []Transaction
Utxorpc() *utxorpc.Block
}

type BlockHeader interface {
Hash() string
PrevHash() string
BlockNumber() uint64
SlotNumber() uint64
IssuerVkey() IssuerVkey
BlockBodySize() uint64
Era() Era
Cbor() []byte
}