Change type of timestamp in transaction
This commit is contained in:
parent
59aa9f5889
commit
d9a0fa9194
@ -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{
|
||||||
|
Loading…
Reference in New Issue
Block a user