panic wrapper functions

This commit is contained in:
Ethan Buchman
2015-07-21 10:46:05 -04:00
parent 5983088a32
commit 8e50bf15de
45 changed files with 229 additions and 275 deletions
+2 -2
View File
@@ -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()
}
+1 -1
View File
@@ -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
View File
@@ -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()...)