mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-05 23:57:04 +00:00
panic wrapper functions
This commit is contained in:
+2
-5
@@ -36,10 +36,7 @@ func (part *Part) Hash() []byte {
|
||||
return part.hash
|
||||
} else {
|
||||
hasher := ripemd160.New()
|
||||
_, err := hasher.Write(part.Bytes)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
hasher.Write(part.Bytes) // doesn't err
|
||||
part.hash = hasher.Sum(nil)
|
||||
return part.hash
|
||||
}
|
||||
@@ -226,7 +223,7 @@ func (ps *PartSet) IsComplete() bool {
|
||||
|
||||
func (ps *PartSet) GetReader() io.Reader {
|
||||
if !ps.IsComplete() {
|
||||
panic("Cannot GetReader() on incomplete PartSet")
|
||||
PanicSanity("Cannot GetReader() on incomplete PartSet")
|
||||
}
|
||||
buf := []byte{}
|
||||
for _, part := range ps.parts {
|
||||
|
||||
+2
-2
@@ -305,7 +305,7 @@ type DupeoutTx struct {
|
||||
}
|
||||
|
||||
func (tx *DupeoutTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) {
|
||||
panic("DupeoutTx has no sign bytes")
|
||||
PanicSanity("DupeoutTx has no sign bytes")
|
||||
}
|
||||
|
||||
func (tx *DupeoutTx) String() string {
|
||||
@@ -326,7 +326,7 @@ func TxID(chainID string, tx Tx) []byte {
|
||||
func jsonEscape(str string) string {
|
||||
escapedBytes, err := json.Marshal(str)
|
||||
if err != nil {
|
||||
panic(Fmt("Error json-escaping a string", str))
|
||||
PanicSanity(Fmt("Error json-escaping a string", str))
|
||||
}
|
||||
return string(escapedBytes)
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ func (vote *Vote) String() string {
|
||||
case VoteTypePrecommit:
|
||||
typeString = "Precommit"
|
||||
default:
|
||||
panic("Unknown vote type")
|
||||
PanicSanity("Unknown vote type")
|
||||
}
|
||||
|
||||
return fmt.Sprintf("Vote{%v/%02d/%v(%v) %X#%v %v}", vote.Height, vote.Round, vote.Type, typeString, Fingerprint(vote.BlockHash), vote.BlockParts, vote.Signature)
|
||||
|
||||
Reference in New Issue
Block a user