diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..294967564 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +all: build + +build: + go build -o tendermint github.com/tendermint/tendermint/cmd + +test: + go test github.com/tendermint/tendermint/... + +list_deps: + go list -f '{{join .Deps "\n"}}' github.com/tendermint/tendermint/... | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' + +get_deps: + go get github.com/tendermint/tendermint/... diff --git a/account/signature.go b/account/signature.go index 7b9d6b5f0..691b6d68e 100644 --- a/account/signature.go +++ b/account/signature.go @@ -2,6 +2,7 @@ package account import ( "errors" + "fmt" "io" "reflect" @@ -56,3 +57,7 @@ func (sig SignatureEd25519) ValidateBasic() error { func (sig SignatureEd25519) IsZero() bool { return len(sig.Bytes) == 0 } + +func (sig SignatureEd25519) String() string { + return fmt.Sprintf("%X", Fingerprint(sig.Bytes)) +} diff --git a/binary/reflect.go b/binary/reflect.go index 1bf28245a..fda0fc49f 100644 --- a/binary/reflect.go +++ b/binary/reflect.go @@ -189,13 +189,8 @@ func writeReflect(rv reflect.Value, rt reflect.Type, w io.Writer, n *int64, err return } - // Dereference pointer or interface - if rt.Kind() == reflect.Ptr { - rt = rt.Elem() - rv = rv.Elem() - // RegisterType registers the ptr type, - // so typeInfo is already for the ptr. - } else if rt.Kind() == reflect.Interface { + // Dereference interface + if rt.Kind() == reflect.Interface { rv = rv.Elem() rt = rv.Type() typeInfo = typeInfos[rt] @@ -205,6 +200,14 @@ func writeReflect(rv reflect.Value, rt reflect.Type, w io.Writer, n *int64, err } } + // Dereference pointer + if rt.Kind() == reflect.Ptr { + rt = rt.Elem() + rv = rv.Elem() + // RegisterType registers the ptr type, + // so typeInfo is already for the ptr. + } + // Write TypeByte prefix if typeInfo.HasTypeByte { WriteByte(typeInfo.TypeByte, w, n, err) @@ -215,7 +218,7 @@ func writeReflect(rv reflect.Value, rt reflect.Type, w io.Writer, n *int64, err elemRt := rt.Elem() if elemRt.Kind() == reflect.Uint8 { // Special case: Byteslices - byteslice := rv.Interface().([]byte) + byteslice := rv.Bytes() WriteByteSlice(byteslice, w, n, err) } else { // Write length diff --git a/cmd/main.go b/cmd/main.go index 35a8446d4..8cb9ed0e2 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -33,6 +33,6 @@ Commands: case "probe_upnp": probe_upnp() default: - fmt.Println("Unknown command %v", args[0]) + fmt.Printf("Unknown command %v\n", args[0]) } } diff --git a/mempool/log.go b/mempool/log.go index 8e2775f95..dabc294ff 100644 --- a/mempool/log.go +++ b/mempool/log.go @@ -6,10 +6,6 @@ import ( var log = logging.MustGetLogger("mempool") -func init() { - logging.SetFormatter(logging.MustStringFormatter("[%{level:.1s}] %{message}")) -} - func SetMempoolLogger(l *logging.Logger) { log = l } diff --git a/p2p/connection.go b/p2p/connection.go index 607f91208..58ea68576 100644 --- a/p2p/connection.go +++ b/p2p/connection.go @@ -183,6 +183,7 @@ func (c *MConnection) Send(chId byte, msg interface{}) bool { } log.Debug("[%X] Send to %v: %v", chId, c, msg) + log.Debug(" Bytes: %X", BinaryBytes(msg)) // Send message to channel. channel, ok := c.channelsIdx[chId]