From df733fbaa5725bbf53bfd937386fe092ec76fcc3 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Sun, 18 Oct 2015 14:44:52 -0700 Subject: [PATCH] Docker run.sh passes seeds and moniker; wire json pretty print --- DOCKER/run.sh | 3 ++- wire/util.go | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/DOCKER/run.sh b/DOCKER/run.sh index 1644b4b4a..903cf667c 100755 --- a/DOCKER/run.sh +++ b/DOCKER/run.sh @@ -1,9 +1,10 @@ #! /bin/bash mkdir -p $GOPATH/src/$TMREPO +cd $GOPATH/src/$TMREPO git clone https://$TMREPO.git . git fetch git reset --hard $TMHEAD go get -d $TMREPO/cmd/tendermint make -tendermint node +tendermint node --seeds="$TMSEEDS" --moniker="$TMNAME" diff --git a/wire/util.go b/wire/util.go index cde0aefbf..0b70194d9 100644 --- a/wire/util.go +++ b/wire/util.go @@ -3,6 +3,8 @@ package wire import ( "bytes" "crypto/sha256" + "encoding/json" + "github.com/tendermint/tendermint/Godeps/_workspace/src/code.google.com/p/go.crypto/ripemd160" . "github.com/tendermint/tendermint/common" @@ -26,6 +28,21 @@ func JSONBytes(o interface{}) []byte { return w.Bytes() } +// NOTE: inefficient +func JSONBytesPretty(o interface{}) []byte { + jsonBytes := JSONBytes(o) + var object interface{} + err := json.Unmarshal(jsonBytes, &object) + if err != nil { + PanicSanity(err) + } + jsonBytes, err = json.MarshalIndent(object, "", "\t") + if err != nil { + PanicSanity(err) + } + return jsonBytes +} + // NOTE: does not care about the type, only the binary representation. func BinaryEqual(a, b interface{}) bool { aBytes := BinaryBytes(a)