diff --git a/cmd/counter/main.go b/cmd/counter/main.go index 7c31aff7..f36394e7 100644 --- a/cmd/counter/main.go +++ b/cmd/counter/main.go @@ -1,6 +1,8 @@ package main import ( + "flag" + . "github.com/tendermint/go-common" "github.com/tendermint/tmsp/example" "github.com/tendermint/tmsp/server" @@ -8,8 +10,12 @@ import ( func main() { + serialPtr := flag.Bool("serial", false, "Enforce incrementing (serial) txs") + flag.Parse() + app := example.NewCounterApplication(*serialPtr) + // Start the listener - _, err := server.StartListener("tcp://0.0.0.0:46658", example.NewCounterApplication()) + _, err := server.StartListener("tcp://0.0.0.0:46658", app) if err != nil { Exit(err.Error()) } diff --git a/example/counter.go b/example/counter.go index 7b0ff1f8..9e4b8671 100644 --- a/example/counter.go +++ b/example/counter.go @@ -13,10 +13,11 @@ type CounterApplication struct { hashCount int txCount int commitCount int + serial bool } -func NewCounterApplication() *CounterApplication { - return &CounterApplication{} +func NewCounterApplication(serial bool) *CounterApplication { + return &CounterApplication{serial: serial} } func (app *CounterApplication) Open() types.AppContext { @@ -25,6 +26,7 @@ func (app *CounterApplication) Open() types.AppContext { hashCount: app.hashCount, txCount: app.txCount, commitCount: app.commitCount, + serial: app.serial, } } diff --git a/test.sh b/test.sh old mode 100644 new mode 100755