mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 06:15:33 +00:00
* Rebased and git-squashed the commits in PR #6546 migrate abci to finalizeBlock work on abci, proxy and mempool abciresponse, blok events, indexer, some tests fix some tests fix errors fix errors in abci fix tests amd errors * Fixes after rebasing PR#6546 * Restored height to RequestFinalizeBlock & other * Fixed more UTs * Fixed kvstore * More UT fixes * last TC fixed * make format * Update internal/consensus/mempool_test.go Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com> * Addressed @williambanfield's comments * Fixed UTs * Addressed last comments from @williambanfield * make format Co-authored-by: marbar3778 <marbar3778@yahoo.com> Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
33 lines
679 B
Go
33 lines
679 B
Go
package factory
|
|
|
|
import (
|
|
"encoding/hex"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/tendermint/tendermint/libs/rand"
|
|
"github.com/tendermint/tendermint/types"
|
|
)
|
|
|
|
// NodeID returns a valid NodeID based on an inputted string
|
|
func NodeID(t *testing.T, str string) types.NodeID {
|
|
t.Helper()
|
|
|
|
id, err := types.NewNodeID(strings.Repeat(str, 2*types.NodeIDByteLength))
|
|
require.NoError(t, err)
|
|
|
|
return id
|
|
}
|
|
|
|
// RandomNodeID returns a randomly generated valid NodeID
|
|
func RandomNodeID(t *testing.T) types.NodeID {
|
|
t.Helper()
|
|
|
|
id, err := types.NewNodeID(hex.EncodeToString(rand.Bytes(types.NodeIDByteLength)))
|
|
require.NoError(t, err)
|
|
|
|
return id
|
|
}
|