mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-18 03:07:51 +01:00
Add node ID field to file structure
This commit is contained in:
@@ -36,6 +36,7 @@ import (
|
||||
// It has no upper size limit, although a soft limit of 64 KB - overhead is encouraged for efficiency.
|
||||
type Block struct {
|
||||
OwnerPublicKey *btcec.PublicKey // Owner Public Key, ECDSA (secp256k1) 257-bit
|
||||
NodeID []byte // Node ID of the owner (derived from the public key)
|
||||
LastBlockHash []byte // Hash of the last block. Blake3.
|
||||
BlockchainVersion uint64 // Blockchain version
|
||||
Number uint64 // Block number
|
||||
@@ -67,6 +68,8 @@ func decodeBlock(raw []byte) (block *Block, err error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
block.NodeID = PublicKey2NodeID(block.OwnerPublicKey)
|
||||
|
||||
block.LastBlockHash = make([]byte, hashSize)
|
||||
copy(block.LastBlockHash, raw[65:65+hashSize])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user