core: update genesis block to store timestamp in ms

This commit is contained in:
Roman Khimov 2020-06-05 13:05:50 +03:00
parent 35b30ccfdf
commit f63b286c35
4 changed files with 3 additions and 3 deletions

View file

@ -60,7 +60,7 @@ func newBlock(cfg config.ProtocolConfiguration, index uint32, prev util.Uint256,
Base: block.Base{ Base: block.Base{
Version: 0, Version: 0,
PrevHash: prev, PrevHash: prev,
Timestamp: uint64(time.Now().UTC().Unix()) + uint64(index), Timestamp: uint64(time.Now().UTC().Unix())*1000 + uint64(index),
Index: index, Index: index,
NextConsensus: witness.ScriptHash(), NextConsensus: witness.ScriptHash(),
Script: witness, Script: witness,

View file

@ -46,7 +46,7 @@ func createGenesisBlock(cfg config.ProtocolConfiguration) (*block.Block, error)
base := block.Base{ base := block.Base{
Version: 0, Version: 0,
PrevHash: util.Uint256{}, PrevHash: util.Uint256{},
Timestamp: uint64(time.Date(2016, 7, 15, 15, 8, 21, 0, time.UTC).Unix()), Timestamp: uint64(time.Date(2016, 7, 15, 15, 8, 21, 0, time.UTC).Unix()) * 1000, // Milliseconds.
Index: 0, Index: 0,
NextConsensus: nextConsensus, NextConsensus: nextConsensus,
Script: transaction.Witness{ Script: transaction.Witness{

View file

@ -20,7 +20,7 @@ func TestGenesisBlockMainNet(t *testing.T) {
// have been changed. Consequently, hash of the genesis block has been changed. // have been changed. Consequently, hash of the genesis block has been changed.
// Update expected genesis block hash for better times. // Update expected genesis block hash for better times.
// Old hash is "d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf" // Old hash is "d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf"
expect := "d2e6d56c734f24c294a74785023af23f20347d97ef92e7bff1b337e37acbf2dd" expect := "30b7e37836146ef63ffdc28411c6c22153b69d8fb10b1d5b96ea662cfb19d2e8"
assert.Equal(t, expect, block.Hash().StringLE()) assert.Equal(t, expect, block.Hash().StringLE())
} }

Binary file not shown.