Change type of timestamp in transaction

This commit is contained in:
ChronosX88 2021-05-14 22:42:22 +03:00
parent 59aa9f5889
commit d9a0fa9194
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A

View File

@ -10,12 +10,12 @@ import (
type Transaction struct { type Transaction struct {
Hash []byte Hash []byte
Timestamp int64 Timestamp time.Time
Data []byte Data []byte
} }
func CreateTransaction(data []byte) *Transaction { func CreateTransaction(data []byte) *Transaction {
timestamp := time.Now().Unix() timestamp := time.Now()
encodedData := hex.EncodeToString(data) encodedData := hex.EncodeToString(data)
hash := crypto.Keccak256([]byte(fmt.Sprintf("%d_%s", timestamp, encodedData))) hash := crypto.Keccak256([]byte(fmt.Sprintf("%d_%s", timestamp, encodedData)))
return &Transaction{ return &Transaction{