2020-05-18 11:23:55 +00:00
|
|
|
/*
|
|
|
|
Package header contains functions working with block headers.
|
|
|
|
*/
|
2018-08-21 10:57:48 +00:00
|
|
|
package header
|
|
|
|
|
2020-05-18 11:23:55 +00:00
|
|
|
// Header represents Neo block header type, it's an opaque data structure that
|
|
|
|
// can be used by functions from this package. You can create it with
|
|
|
|
// blockchain.GetHeader. In its function it's similar to the Header class
|
|
|
|
// of the Neo .net framework.
|
2018-08-21 10:57:48 +00:00
|
|
|
type Header struct{}
|
|
|
|
|
2020-05-18 11:23:55 +00:00
|
|
|
// GetIndex returns the index (height) of the given header. It uses
|
|
|
|
// `Neo.Header.GetIndex` syscall.
|
2018-08-21 10:57:48 +00:00
|
|
|
func GetIndex(h Header) int {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2020-05-18 11:23:55 +00:00
|
|
|
// GetHash returns the hash (256-bit BE value packed into 32 byte slice) of the
|
|
|
|
// given header (which also is a hash of the block). It uses `Neo.Header.GetHash`
|
|
|
|
// syscall.
|
2018-08-21 10:57:48 +00:00
|
|
|
func GetHash(h Header) []byte {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-05-18 11:23:55 +00:00
|
|
|
// GetPrevHash returns the hash (256-bit BE value packed into 32 byte slice) of
|
|
|
|
// the previous block stored in the given header. It uses `Neo.Header.GetPrevHash`
|
|
|
|
// syscall.
|
2018-08-21 10:57:48 +00:00
|
|
|
func GetPrevHash(h Header) []byte {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-05-18 11:23:55 +00:00
|
|
|
// GetTimestamp returns the timestamp of the given header. It uses
|
|
|
|
// `Neo.Header.GetTimestamp` syscall.
|
2018-08-21 10:57:48 +00:00
|
|
|
func GetTimestamp(h Header) int {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2020-05-18 11:23:55 +00:00
|
|
|
// GetVersion returns the version of the given header. It uses
|
|
|
|
// `Neo.Header.GetVersion` syscall.
|
2018-08-21 10:57:48 +00:00
|
|
|
func GetVersion(h Header) int {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2020-05-18 11:23:55 +00:00
|
|
|
// GetMerkleRoot returns the Merkle root (256-bit BE value packed into 32 byte
|
|
|
|
// slice) of the given header. It uses `Neo.Header.GetMerkleRoot` syscall.
|
2018-08-21 10:57:48 +00:00
|
|
|
func GetMerkleRoot(h Header) []byte {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-05-18 11:23:55 +00:00
|
|
|
// GetConsensusData returns the consensus data (nonce) of the given header.
|
|
|
|
// It uses `Neo.Header.GetConsensusData` syscall.
|
2018-08-21 10:57:48 +00:00
|
|
|
func GetConsensusData(h Header) int {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2020-05-18 11:23:55 +00:00
|
|
|
// GetNextConsensus returns the next consensus field (verification script hash,
|
|
|
|
// 160-bit BE value packed into 20 byte slice) of the given header. It uses
|
|
|
|
// `Neo.Header.GetNextConsensus` syscall.
|
2018-08-21 10:57:48 +00:00
|
|
|
func GetNextConsensus(h Header) []byte {
|
|
|
|
return nil
|
|
|
|
}
|