mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-23 17:51:39 +00:00
share block parts when we're the proposer
This commit is contained in:
41
consensus/document.go
Normal file
41
consensus/document.go
Normal file
@ -0,0 +1,41 @@
|
||||
package consensus
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "github.com/tendermint/tendermint/config"
|
||||
)
|
||||
|
||||
func GenVoteDocument(voteType byte, height uint32, round uint16, proposalHash []byte) string {
|
||||
stepName := ""
|
||||
switch voteType {
|
||||
case VoteTypeBare:
|
||||
stepName = "bare"
|
||||
case VoteTypePrecommit:
|
||||
stepName = "precommit"
|
||||
case VoteTypeCommit:
|
||||
stepName = "commit"
|
||||
default:
|
||||
panic("Unknown vote type")
|
||||
}
|
||||
return fmt.Sprintf(
|
||||
`-----BEGIN TENDERMINT DOCUMENT-----
|
||||
URI: %v://consensus/%v/%v/%v
|
||||
ProposalHash: %X
|
||||
-----END TENDERMINT DOCUMENHT-----`,
|
||||
Config.Network, height, round, stepName,
|
||||
proposalHash,
|
||||
)
|
||||
}
|
||||
|
||||
func GenBlockPartDocument(height uint32, round uint16, index uint16, total uint16, blockPartHash []byte) string {
|
||||
return fmt.Sprintf(
|
||||
`-----BEGIN TENDERMINT DOCUMENT-----
|
||||
URI: %v://blockpart/%v/%v/%v
|
||||
Total: %v
|
||||
BlockPartHash: %X
|
||||
-----END TENDERMINT DOCUMENHT-----`,
|
||||
Config.Network, height, round, index,
|
||||
total,
|
||||
blockPartHash,
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user