commit inicial do projeto
This commit is contained in:
18
internal/consensus/proposer.go
Normal file
18
internal/consensus/proposer.go
Normal file
@ -0,0 +1,18 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user