|
|
@ -28,7 +28,6 @@ import ( |
|
|
|
"github.com/tendermint/tendermint/proxy" |
|
|
|
sm "github.com/tendermint/tendermint/state" |
|
|
|
"github.com/tendermint/tendermint/types" |
|
|
|
tmtime "github.com/tendermint/tendermint/types/time" |
|
|
|
"github.com/tendermint/tendermint/version" |
|
|
|
dbm "github.com/tendermint/tm-cmn/db" |
|
|
|
) |
|
|
@ -849,31 +848,14 @@ func makeBlocks(n int, state *sm.State, privVal types.PrivValidator) []*types.Bl |
|
|
|
return blocks |
|
|
|
} |
|
|
|
|
|
|
|
func makeVote(header *types.Header, blockID types.BlockID, valset *types.ValidatorSet, privVal types.PrivValidator) *types.Vote { |
|
|
|
addr := privVal.GetPubKey().Address() |
|
|
|
idx, _ := valset.GetByAddress(addr) |
|
|
|
vote := &types.Vote{ |
|
|
|
ValidatorAddress: addr, |
|
|
|
ValidatorIndex: idx, |
|
|
|
Height: header.Height, |
|
|
|
Round: 1, |
|
|
|
Timestamp: tmtime.Now(), |
|
|
|
Type: types.PrecommitType, |
|
|
|
BlockID: blockID, |
|
|
|
} |
|
|
|
|
|
|
|
privVal.SignVote(header.ChainID, vote) |
|
|
|
|
|
|
|
return vote |
|
|
|
} |
|
|
|
|
|
|
|
func makeBlock(state sm.State, lastBlock *types.Block, lastBlockMeta *types.BlockMeta, |
|
|
|
privVal types.PrivValidator, height int64) (*types.Block, *types.PartSet) { |
|
|
|
|
|
|
|
lastCommit := types.NewCommit(types.BlockID{}, nil) |
|
|
|
if height > 1 { |
|
|
|
vote := makeVote(&lastBlock.Header, lastBlockMeta.BlockID, state.Validators, privVal).CommitSig() |
|
|
|
lastCommit = types.NewCommit(lastBlockMeta.BlockID, []*types.CommitSig{vote}) |
|
|
|
vote, _ := types.MakeVote(lastBlock.Header.Height, lastBlockMeta.BlockID, state.Validators, privVal, lastBlock.Header.ChainID) |
|
|
|
voteCommitSig := vote.CommitSig() |
|
|
|
lastCommit = types.NewCommit(lastBlockMeta.BlockID, []*types.CommitSig{voteCommitSig}) |
|
|
|
} |
|
|
|
|
|
|
|
return state.MakeBlock(height, []types.Tx{}, lastCommit, nil, state.Validators.GetProposer().Address) |
|
|
|