@@ -17,12 +17,12 @@ const (
1717
1818// Header represents a Bitcoin block header (80 bytes)
1919type Header struct {
20- Version int32 // 4 bytes - Block version
21- PrevBlock chainhash.Hash // 32 bytes - Previous block hash
22- MerkleRoot chainhash.Hash // 32 bytes - Merkle root hash
23- Timestamp uint32 // 4 bytes - Block timestamp (Unix time)
24- Bits uint32 // 4 bytes - Difficulty target
25- Nonce uint32 // 4 bytes - Nonce
20+ Version int32 `json:"version"` // 4 bytes - Block version
21+ PrevBlock chainhash.Hash `json:"prevBlock"` // 32 bytes - Previous block hash
22+ MerkleRoot chainhash.Hash `json:"merkleRoot"` // 32 bytes - Merkle root hash
23+ Timestamp uint32 `json:"timestamp"` // 4 bytes - Block timestamp (Unix time)
24+ Bits uint32 `json:"bits"` // 4 bytes - Difficulty target
25+ Nonce uint32 `json:"nonce"` // 4 bytes - Nonce
2626}
2727
2828// NewHeaderFromBytes creates a BlockHeader from an 80-byte slice
@@ -82,7 +82,7 @@ func (h *Header) Bytes() []byte {
8282 buf .Grow (HeaderSize )
8383
8484 // Write version (4 bytes, little-endian)
85- binary .Write (buf , binary .LittleEndian , h .Version )
85+ _ = binary .Write (buf , binary .LittleEndian , h .Version )
8686
8787 // Write previous block hash (32 bytes)
8888 buf .Write (h .PrevBlock [:])
@@ -91,13 +91,13 @@ func (h *Header) Bytes() []byte {
9191 buf .Write (h .MerkleRoot [:])
9292
9393 // Write timestamp (4 bytes, little-endian)
94- binary .Write (buf , binary .LittleEndian , h .Timestamp )
94+ _ = binary .Write (buf , binary .LittleEndian , h .Timestamp )
9595
9696 // Write bits (4 bytes, little-endian)
97- binary .Write (buf , binary .LittleEndian , h .Bits )
97+ _ = binary .Write (buf , binary .LittleEndian , h .Bits )
9898
9999 // Write nonce (4 bytes, little-endian)
100- binary .Write (buf , binary .LittleEndian , h .Nonce )
100+ _ = binary .Write (buf , binary .LittleEndian , h .Nonce )
101101
102102 return buf .Bytes ()
103103}
0 commit comments