mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-26 03:01:42 +00:00
Add PartSet test.
This commit is contained in:
@ -4,7 +4,9 @@ import (
|
||||
"bytes"
|
||||
"crypto/sha256"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
. "github.com/tendermint/tendermint/binary"
|
||||
@ -59,6 +61,26 @@ func (pt *Part) Hash() []byte {
|
||||
}
|
||||
}
|
||||
|
||||
func (pt *Part) String() string {
|
||||
return pt.StringWithIndent("")
|
||||
}
|
||||
|
||||
func (pt *Part) StringWithIndent(indent string) string {
|
||||
trailStrings := make([]string, len(pt.Trail))
|
||||
for i, hash := range pt.Trail {
|
||||
trailStrings[i] = fmt.Sprintf("%X", hash)
|
||||
}
|
||||
return fmt.Sprintf(`Part{
|
||||
%s Index: %v
|
||||
%s Trail:
|
||||
%s %v
|
||||
%s}`,
|
||||
indent, pt.Index,
|
||||
indent,
|
||||
indent, strings.Join(trailStrings, "\n"+indent+" "),
|
||||
indent)
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
type PartSet struct {
|
||||
|
Reference in New Issue
Block a user