mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-18 22:14:35 +00:00
libs/common: Refactor libs/common 4 (#4237)
* libs/common: Refactor libs/common 4 - move byte function out of cmn to its own pkg - move tempfile out of cmn to its own pkg - move throttletimer to its own pkg ref #4147 Signed-off-by: Marko Baricevic <marbar3778@yahoo.com> * add changelog entry * fix linting issues
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
cstypes "github.com/tendermint/tendermint/consensus/types"
|
||||
tmbytes "github.com/tendermint/tendermint/libs/bytes"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmpubsub "github.com/tendermint/tendermint/libs/pubsub"
|
||||
@@ -518,7 +519,7 @@ func ensureNewBlock(blockCh <-chan tmpubsub.Message, height int64) {
|
||||
}
|
||||
}
|
||||
|
||||
func ensureNewBlockHeader(blockCh <-chan tmpubsub.Message, height int64, blockHash cmn.HexBytes) {
|
||||
func ensureNewBlockHeader(blockCh <-chan tmpubsub.Message, height int64, blockHash tmbytes.HexBytes) {
|
||||
select {
|
||||
case <-time.After(ensureTimeout):
|
||||
panic("Timeout expired while waiting for NewBlockHeader event")
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
cstypes "github.com/tendermint/tendermint/consensus/types"
|
||||
"github.com/tendermint/tendermint/crypto/tmhash"
|
||||
"github.com/tendermint/tendermint/libs/bytes"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
mempl "github.com/tendermint/tendermint/mempool"
|
||||
@@ -850,10 +851,10 @@ func TestVoteSetMaj23MessageValidateBasic(t *testing.T) {
|
||||
|
||||
validBlockID := types.BlockID{}
|
||||
invalidBlockID := types.BlockID{
|
||||
Hash: cmn.HexBytes{},
|
||||
Hash: bytes.HexBytes{},
|
||||
PartsHeader: types.PartSetHeader{
|
||||
Total: -1,
|
||||
Hash: cmn.HexBytes{},
|
||||
Hash: bytes.HexBytes{},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -898,10 +899,10 @@ func TestVoteSetBitsMessageValidateBasic(t *testing.T) {
|
||||
{func(msg *VoteSetBitsMessage) { msg.Type = 0x03 }, "invalid Type"},
|
||||
{func(msg *VoteSetBitsMessage) {
|
||||
msg.BlockID = types.BlockID{
|
||||
Hash: cmn.HexBytes{},
|
||||
Hash: bytes.HexBytes{},
|
||||
PartsHeader: types.PartSetHeader{
|
||||
Total: -1,
|
||||
Hash: cmn.HexBytes{},
|
||||
Hash: bytes.HexBytes{},
|
||||
},
|
||||
}
|
||||
}, "wrong BlockID: wrong PartsHeader: negative Total"},
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
"github.com/tendermint/tendermint/libs/bytes"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
@@ -97,9 +97,9 @@ type RoundState struct {
|
||||
type RoundStateSimple struct {
|
||||
HeightRoundStep string `json:"height/round/step"`
|
||||
StartTime time.Time `json:"start_time"`
|
||||
ProposalBlockHash cmn.HexBytes `json:"proposal_block_hash"`
|
||||
LockedBlockHash cmn.HexBytes `json:"locked_block_hash"`
|
||||
ValidBlockHash cmn.HexBytes `json:"valid_block_hash"`
|
||||
ProposalBlockHash bytes.HexBytes `json:"proposal_block_hash"`
|
||||
LockedBlockHash bytes.HexBytes `json:"locked_block_hash"`
|
||||
ValidBlockHash bytes.HexBytes `json:"valid_block_hash"`
|
||||
Votes json.RawMessage `json:"height_vote_set"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user