This commit is contained in:
Stas 2021-11-25 12:04:42 +03:00 committed by GitHub
commit a0a18516df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -35,9 +35,9 @@ func (pow *ProofOfWork) prepareData(nonce int) []byte {
[][]byte{
pow.block.PrevBlockHash,
pow.block.HashTransactions(),
IntToHex(pow.block.Timestamp),
IntToHex(int64(targetBits)),
IntToHex(int64(nonce)),
IntToBytes(pow.block.Timestamp),
IntToBytes(int64(targetBits)),
IntToBytes(int64(nonce)),
},
[]byte{},
)

View File

@ -7,7 +7,7 @@ import (
)
// IntToHex converts an int64 to a byte array
func IntToHex(num int64) []byte {
func IntToBytes(num int64) []byte {
buff := new(bytes.Buffer)
err := binary.Write(buff, binary.BigEndian, num)
if err != nil {