Skip to content

Commit 79d22a1

Browse files
authored
refactor: move block to ledger/common w/ compat (#799)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 177d2d2 commit 79d22a1

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

ledger/block.go

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 Blink Labs Software
1+
// Copyright 2024 Blink Labs Software
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -17,26 +17,12 @@ package ledger
1717
import (
1818
"fmt"
1919

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

23-
type Block interface {
24-
BlockHeader
25-
Type() int
26-
Transactions() []Transaction
27-
Utxorpc() *utxorpc.Block
28-
}
29-
30-
type BlockHeader interface {
31-
Hash() string
32-
PrevHash() string
33-
BlockNumber() uint64
34-
SlotNumber() uint64
35-
IssuerVkey() IssuerVkey
36-
BlockBodySize() uint64
37-
Era() Era
38-
Cbor() []byte
39-
}
23+
// Compatibility aliases
24+
type Block = common.Block
25+
type BlockHeader = common.BlockHeader
4026

4127
func NewBlockFromCbor(blockType uint, data []byte) (Block, error) {
4228
switch blockType {

ledger/common/block.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package common
2+
3+
import utxorpc "github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano"
4+
5+
type Block interface {
6+
BlockHeader
7+
Type() int
8+
Transactions() []Transaction
9+
Utxorpc() *utxorpc.Block
10+
}
11+
12+
type BlockHeader interface {
13+
Hash() string
14+
PrevHash() string
15+
BlockNumber() uint64
16+
SlotNumber() uint64
17+
IssuerVkey() IssuerVkey
18+
BlockBodySize() uint64
19+
Era() Era
20+
Cbor() []byte
21+
}

0 commit comments

Comments
 (0)