mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 23:02:16 +00:00
Add way to enforce serial order in counter app from command line
This commit is contained in:
parent
36e89b606e
commit
5c20d1b3e5
@ -1,6 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
|
|
||||||
. "github.com/tendermint/go-common"
|
. "github.com/tendermint/go-common"
|
||||||
"github.com/tendermint/tmsp/example"
|
"github.com/tendermint/tmsp/example"
|
||||||
"github.com/tendermint/tmsp/server"
|
"github.com/tendermint/tmsp/server"
|
||||||
@ -8,8 +10,12 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
|
serialPtr := flag.Bool("serial", false, "Enforce incrementing (serial) txs")
|
||||||
|
flag.Parse()
|
||||||
|
app := example.NewCounterApplication(*serialPtr)
|
||||||
|
|
||||||
// Start the listener
|
// 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 {
|
if err != nil {
|
||||||
Exit(err.Error())
|
Exit(err.Error())
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,11 @@ type CounterApplication struct {
|
|||||||
hashCount int
|
hashCount int
|
||||||
txCount int
|
txCount int
|
||||||
commitCount int
|
commitCount int
|
||||||
|
serial bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCounterApplication() *CounterApplication {
|
func NewCounterApplication(serial bool) *CounterApplication {
|
||||||
return &CounterApplication{}
|
return &CounterApplication{serial: serial}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *CounterApplication) Open() types.AppContext {
|
func (app *CounterApplication) Open() types.AppContext {
|
||||||
@ -25,6 +26,7 @@ func (app *CounterApplication) Open() types.AppContext {
|
|||||||
hashCount: app.hashCount,
|
hashCount: app.hashCount,
|
||||||
txCount: app.txCount,
|
txCount: app.txCount,
|
||||||
commitCount: app.commitCount,
|
commitCount: app.commitCount,
|
||||||
|
serial: app.serial,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user