Skip to content

Commit

Permalink
dbft: remove ConsensusData() API of dbft.Block
Browse files Browse the repository at this point in the history
It's unused by dBFT and thus, should be removed from Block interface. If
user need to access this data, then he should convert dbft.Block to the
local user-defined Block implementation.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
  • Loading branch information
AnnaShaleva committed Mar 6, 2024
1 parent 0cf24d0 commit f3de891
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
2 changes: 0 additions & 2 deletions block.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ type Block[H Hash] interface {
MerkleRoot() H
// Index returns block index.
Index() uint32
// ConsensusData is a random nonce.
ConsensusData() uint64

// Signature returns block's signature.
Signature() []byte
Expand Down
12 changes: 3 additions & 9 deletions internal/consensus/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ type (
neoBlock struct {
base

consensusData uint64
transactions []dbft.Transaction[crypto.Uint256]
signature []byte
hash *crypto.Uint256
transactions []dbft.Transaction[crypto.Uint256]
signature []byte
hash *crypto.Uint256
}
)

Expand All @@ -47,11 +46,6 @@ func (b *neoBlock) MerkleRoot() crypto.Uint256 {
return b.base.MerkleRoot
}

// ConsensusData implements Block interface.
func (b *neoBlock) ConsensusData() uint64 {
return b.consensusData
}

// Transactions implements Block interface.
func (b *neoBlock) Transactions() []dbft.Transaction[crypto.Uint256] {
return b.transactions
Expand Down
3 changes: 0 additions & 3 deletions internal/consensus/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ func TestNeoBlock_Setters(t *testing.T) {
b.SetTransactions(txs)
assert.Equal(t, txs, b.Transactions())

b.consensusData = 123
assert.EqualValues(t, 123, b.ConsensusData())

b.base.PrevHash = crypto.Uint256{3, 7}
assert.Equal(t, crypto.Uint256{3, 7}, b.PrevHash())

Expand Down

0 comments on commit f3de891

Please sign in to comment.