mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
consensus.Block: removed unnecessary setters
As far as we have consensus context in NewBlockFromContext, we don't need them anymore.
This commit is contained in:
parent
6db4ca874d
commit
dbda721599
4 changed files with 12 additions and 40 deletions
|
@ -22,30 +22,26 @@ func TestNeoBlock_Sign(t *testing.T) {
|
|||
func TestNeoBlock_Setters(t *testing.T) {
|
||||
b := new(neoBlock)
|
||||
|
||||
b.SetVersion(1)
|
||||
b.Block.Version = 1
|
||||
require.EqualValues(t, 1, b.Version())
|
||||
|
||||
b.SetIndex(12)
|
||||
b.Block.Index = 12
|
||||
require.EqualValues(t, 12, b.Index())
|
||||
|
||||
b.SetTimestamp(777)
|
||||
// 777ns -> 0ms -> 0ns
|
||||
require.EqualValues(t, 0, b.Timestamp())
|
||||
b.Block.Timestamp = 777
|
||||
// 777ms -> 777000000ns
|
||||
require.EqualValues(t, 777000000, b.Timestamp())
|
||||
|
||||
b.SetTimestamp(7777777)
|
||||
// 7777777ns -> 7ms -> 7000000ns
|
||||
require.EqualValues(t, 7000000, b.Timestamp())
|
||||
|
||||
b.SetConsensusData(456)
|
||||
b.Block.ConsensusData.Nonce = 456
|
||||
require.EqualValues(t, 456, b.ConsensusData())
|
||||
|
||||
b.SetMerkleRoot(util.Uint256{1, 2, 3, 4})
|
||||
b.Block.MerkleRoot = util.Uint256{1, 2, 3, 4}
|
||||
require.Equal(t, util.Uint256{1, 2, 3, 4}, b.MerkleRoot())
|
||||
|
||||
b.SetNextConsensus(util.Uint160{9, 2})
|
||||
b.Block.NextConsensus = util.Uint160{9, 2}
|
||||
require.Equal(t, util.Uint160{9, 2}, b.NextConsensus())
|
||||
|
||||
b.SetPrevHash(util.Uint256{9, 8, 7})
|
||||
b.Block.PrevHash = util.Uint256{9, 8, 7}
|
||||
require.Equal(t, util.Uint256{9, 8, 7}, b.PrevHash())
|
||||
|
||||
txx := []block.Transaction{transaction.NewIssueTX()}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue