19 lines
384 B
Go
19 lines
384 B
Go
package consensus
|
|
|
|
import (
|
|
"dejo_node/internal/mempool"
|
|
"dejo_node/internal/transactions"
|
|
"time"
|
|
)
|
|
|
|
func ProposeBlock(index uint64, prevHash string, pool *mempool.Mempool) *transactions.Block {
|
|
block := &transactions.Block{
|
|
Index: index,
|
|
PrevHash: prevHash,
|
|
Timestamp: time.Now().Unix(),
|
|
Txns: pool.All(),
|
|
}
|
|
block.Hash = block.CalculateHash()
|
|
return block
|
|
}
|