mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-26 09:54:19 +00:00
panic wrapper functions
This commit is contained in:
+2
-2
@@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/tendermint/tendermint/binary"
|
||||
. "github.com/tendermint/tendermint/common"
|
||||
"github.com/tendermint/tendermint/merkle"
|
||||
ptypes "github.com/tendermint/tendermint/permission/types"
|
||||
)
|
||||
@@ -21,8 +22,7 @@ func SignBytes(chainID string, o Signable) []byte {
|
||||
buf, n, err := new(bytes.Buffer), new(int64), new(error)
|
||||
o.WriteSignBytes(chainID, buf, n, err)
|
||||
if *err != nil {
|
||||
// SOMETHING HAS GONE HORRIBLY WRONG
|
||||
panic(err)
|
||||
PanicCrisis(err)
|
||||
}
|
||||
return buf.Bytes()
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func GenPrivAccountFromSecret(secret []byte) *PrivAccount {
|
||||
|
||||
func GenPrivAccountFromPrivKeyBytes(privKeyBytes *[64]byte) *PrivAccount {
|
||||
if len(privKeyBytes) != 64 {
|
||||
panic(Fmt("Expected 64 bytes but got %v", len(privKeyBytes)))
|
||||
PanicSanity(Fmt("Expected 64 bytes but got %v", len(privKeyBytes)))
|
||||
}
|
||||
pubKeyBytes := ed25519.MakePublicKey(privKeyBytes)
|
||||
pubKey := PubKeyEd25519(*pubKeyBytes)
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ func (pubKey PubKeyEd25519) Address() []byte {
|
||||
w, n, err := new(bytes.Buffer), new(int64), new(error)
|
||||
binary.WriteBinary(pubKey[:], w, n, err)
|
||||
if *err != nil {
|
||||
panic(*err)
|
||||
PanicCrisis(*err)
|
||||
}
|
||||
// append type byte
|
||||
encodedPubkey := append([]byte{1}, w.Bytes()...)
|
||||
|
||||
Reference in New Issue
Block a user