From f3de891af1118b05775f794c5f7652a3390cfaab Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Wed, 6 Mar 2024 15:24:15 +0300 Subject: [PATCH] dbft: remove ConsensusData() API of dbft.Block 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 --- block.go | 2 -- internal/consensus/block.go | 12 +++--------- internal/consensus/block_test.go | 3 --- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/block.go b/block.go index c24670de..3c51e846 100644 --- a/block.go +++ b/block.go @@ -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 diff --git a/internal/consensus/block.go b/internal/consensus/block.go index fdf36c87..b24d7ccb 100644 --- a/internal/consensus/block.go +++ b/internal/consensus/block.go @@ -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 } ) @@ -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 diff --git a/internal/consensus/block_test.go b/internal/consensus/block_test.go index 09b2d08b..fc67807e 100644 --- a/internal/consensus/block_test.go +++ b/internal/consensus/block_test.go @@ -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())