lint: remove dot import (go-common)
Spell out the package explicitly. This commit is totally textual, and does not change any logic. The swiss-army knife package may serve a kick-start in early stage development. But as the codebase growing, we might want to retire it gradually: For simple wrapping functions, just inline it on the call site. For larger pice of code, make it an independent package.
This commit is contained in:
parent
c65bb21a51
commit
fcaa545e1e
|
@ -5,11 +5,11 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client interface {
|
type Client interface {
|
||||||
Service
|
common.Service
|
||||||
|
|
||||||
SetResponseCallback(Callback)
|
SetResponseCallback(Callback)
|
||||||
Error() error
|
Error() error
|
||||||
|
|
|
@ -9,13 +9,13 @@ import (
|
||||||
grpc "google.golang.org/grpc"
|
grpc "google.golang.org/grpc"
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A stripped copy of the remoteClient that makes
|
// A stripped copy of the remoteClient that makes
|
||||||
// synchronous calls using grpc
|
// synchronous calls using grpc
|
||||||
type grpcClient struct {
|
type grpcClient struct {
|
||||||
BaseService
|
common.BaseService
|
||||||
mustConnect bool
|
mustConnect bool
|
||||||
|
|
||||||
client types.ABCIApplicationClient
|
client types.ABCIApplicationClient
|
||||||
|
@ -31,13 +31,13 @@ func NewGRPCClient(addr string, mustConnect bool) (*grpcClient, error) {
|
||||||
addr: addr,
|
addr: addr,
|
||||||
mustConnect: mustConnect,
|
mustConnect: mustConnect,
|
||||||
}
|
}
|
||||||
cli.BaseService = *NewBaseService(nil, "grpcClient", cli)
|
cli.BaseService = *common.NewBaseService(nil, "grpcClient", cli)
|
||||||
_, err := cli.Start() // Just start it, it's confusing for callers to remember to start.
|
_, err := cli.Start() // Just start it, it's confusing for callers to remember to start.
|
||||||
return cli, err
|
return cli, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func dialerFunc(addr string, timeout time.Duration) (net.Conn, error) {
|
func dialerFunc(addr string, timeout time.Duration) (net.Conn, error) {
|
||||||
return Connect(addr)
|
return common.Connect(addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) OnStart() error {
|
func (cli *grpcClient) OnStart() error {
|
||||||
|
@ -50,7 +50,7 @@ RETRY_LOOP:
|
||||||
if cli.mustConnect {
|
if cli.mustConnect {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
log.Warn(Fmt("abci.grpcClient failed to connect to %v. Retrying...\n", cli.addr))
|
log.Warn(common.Fmt("abci.grpcClient failed to connect to %v. Retrying...\n", cli.addr))
|
||||||
time.Sleep(time.Second * 3)
|
time.Sleep(time.Second * 3)
|
||||||
continue RETRY_LOOP
|
continue RETRY_LOOP
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ func (cli *grpcClient) StopForError(err error) {
|
||||||
}
|
}
|
||||||
cli.mtx.Unlock()
|
cli.mtx.Unlock()
|
||||||
|
|
||||||
log.Warn(Fmt("Stopping abci.grpcClient for error: %v", err.Error()))
|
log.Warn(common.Fmt("Stopping abci.grpcClient for error: %v", err.Error()))
|
||||||
cli.Stop()
|
cli.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
types "github.com/tendermint/abci/types"
|
types "github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type localClient struct {
|
type localClient struct {
|
||||||
BaseService
|
common.BaseService
|
||||||
mtx *sync.Mutex
|
mtx *sync.Mutex
|
||||||
types.Application
|
types.Application
|
||||||
Callback
|
Callback
|
||||||
|
@ -22,7 +22,7 @@ func NewLocalClient(mtx *sync.Mutex, app types.Application) *localClient {
|
||||||
mtx: mtx,
|
mtx: mtx,
|
||||||
Application: app,
|
Application: app,
|
||||||
}
|
}
|
||||||
cli.BaseService = *NewBaseService(log, "localClient", cli)
|
cli.BaseService = *common.NewBaseService(log, "localClient", cli)
|
||||||
return cli
|
return cli
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -27,10 +27,10 @@ const flushThrottleMS = 20 // Don't wait longer than...
|
||||||
// the application in general is not meant to be interfaced
|
// the application in general is not meant to be interfaced
|
||||||
// with concurrent callers.
|
// with concurrent callers.
|
||||||
type socketClient struct {
|
type socketClient struct {
|
||||||
BaseService
|
common.BaseService
|
||||||
|
|
||||||
reqQueue chan *ReqRes
|
reqQueue chan *ReqRes
|
||||||
flushTimer *ThrottleTimer
|
flushTimer *common.ThrottleTimer
|
||||||
mustConnect bool
|
mustConnect bool
|
||||||
|
|
||||||
mtx sync.Mutex
|
mtx sync.Mutex
|
||||||
|
@ -45,14 +45,14 @@ type socketClient struct {
|
||||||
func NewSocketClient(addr string, mustConnect bool) (*socketClient, error) {
|
func NewSocketClient(addr string, mustConnect bool) (*socketClient, error) {
|
||||||
cli := &socketClient{
|
cli := &socketClient{
|
||||||
reqQueue: make(chan *ReqRes, reqQueueSize),
|
reqQueue: make(chan *ReqRes, reqQueueSize),
|
||||||
flushTimer: NewThrottleTimer("socketClient", flushThrottleMS),
|
flushTimer: common.NewThrottleTimer("socketClient", flushThrottleMS),
|
||||||
mustConnect: mustConnect,
|
mustConnect: mustConnect,
|
||||||
|
|
||||||
addr: addr,
|
addr: addr,
|
||||||
reqSent: list.New(),
|
reqSent: list.New(),
|
||||||
resCb: nil,
|
resCb: nil,
|
||||||
}
|
}
|
||||||
cli.BaseService = *NewBaseService(nil, "socketClient", cli)
|
cli.BaseService = *common.NewBaseService(nil, "socketClient", cli)
|
||||||
|
|
||||||
_, err := cli.Start() // Just start it, it's confusing for callers to remember to start.
|
_, err := cli.Start() // Just start it, it's confusing for callers to remember to start.
|
||||||
return cli, err
|
return cli, err
|
||||||
|
@ -65,12 +65,12 @@ func (cli *socketClient) OnStart() error {
|
||||||
var conn net.Conn
|
var conn net.Conn
|
||||||
RETRY_LOOP:
|
RETRY_LOOP:
|
||||||
for {
|
for {
|
||||||
conn, err = Connect(cli.addr)
|
conn, err = common.Connect(cli.addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if cli.mustConnect {
|
if cli.mustConnect {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
log.Warn(Fmt("abci.socketClient failed to connect to %v. Retrying...", cli.addr))
|
log.Warn(common.Fmt("abci.socketClient failed to connect to %v. Retrying...", cli.addr))
|
||||||
time.Sleep(time.Second * 3)
|
time.Sleep(time.Second * 3)
|
||||||
continue RETRY_LOOP
|
continue RETRY_LOOP
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ func (cli *socketClient) StopForError(err error) {
|
||||||
}
|
}
|
||||||
cli.mtx.Unlock()
|
cli.mtx.Unlock()
|
||||||
|
|
||||||
log.Warn(Fmt("Stopping abci.socketClient for error: %v", err.Error()))
|
log.Warn(common.Fmt("Stopping abci.socketClient for error: %v", err.Error()))
|
||||||
cli.Stop()
|
cli.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
"github.com/tendermint/abci/client"
|
"github.com/tendermint/abci/client"
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ func main() {
|
||||||
app.Before = before
|
app.Before = before
|
||||||
err := app.Run(os.Args)
|
err := app.Run(os.Args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
common.Exit(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ func before(c *cli.Context) error {
|
||||||
var err error
|
var err error
|
||||||
client, err = abcicli.NewClient(c.GlobalString("address"), c.GlobalString("abci"), false)
|
client, err = abcicli.NewClient(c.GlobalString("address"), c.GlobalString("abci"), false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
common.Exit(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -244,7 +244,7 @@ func cmdSetOption(c *cli.Context) error {
|
||||||
return errors.New("Command set_option takes 2 arguments (key, value)")
|
return errors.New("Command set_option takes 2 arguments (key, value)")
|
||||||
}
|
}
|
||||||
res := client.SetOptionSync(args[0], args[1])
|
res := client.SetOptionSync(args[0], args[1])
|
||||||
rsp := newResponse(res, Fmt("%s=%s", args[0], args[1]), false)
|
rsp := newResponse(res, common.Fmt("%s=%s", args[0], args[1]), false)
|
||||||
printResponse(c, rsp)
|
printResponse(c, rsp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ func cmdCheckTx(c *cli.Context) error {
|
||||||
// Get application Merkle root hash
|
// Get application Merkle root hash
|
||||||
func cmdCommit(c *cli.Context) error {
|
func cmdCommit(c *cli.Context) error {
|
||||||
res := client.CommitSync()
|
res := client.CommitSync()
|
||||||
rsp := newResponse(res, Fmt("0x%X", res.Data), false)
|
rsp := newResponse(res, common.Fmt("0x%X", res.Data), false)
|
||||||
printResponse(c, rsp)
|
printResponse(c, rsp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/counter"
|
"github.com/tendermint/abci/example/counter"
|
||||||
"github.com/tendermint/abci/server"
|
"github.com/tendermint/abci/server"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -19,11 +19,11 @@ func main() {
|
||||||
// Start the listener
|
// Start the listener
|
||||||
srv, err := server.NewServer(*addrPtr, *abciPtr, app)
|
srv, err := server.NewServer(*addrPtr, *abciPtr, app)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
common.Exit(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait forever
|
// Wait forever
|
||||||
TrapSignal(func() {
|
common.TrapSignal(func() {
|
||||||
// Cleanup
|
// Cleanup
|
||||||
srv.Stop()
|
srv.Stop()
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/dummy"
|
||||||
"github.com/tendermint/abci/server"
|
"github.com/tendermint/abci/server"
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -27,11 +27,11 @@ func main() {
|
||||||
// Start the listener
|
// Start the listener
|
||||||
srv, err := server.NewServer(*addrPtr, *abciPtr, app)
|
srv, err := server.NewServer(*addrPtr, *abciPtr, app)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
common.Exit(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait forever
|
// Wait forever
|
||||||
TrapSignal(func() {
|
common.TrapSignal(func() {
|
||||||
// Cleanup
|
// Cleanup
|
||||||
srv.Stop()
|
srv.Stop()
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/tendermint/abci/server"
|
"github.com/tendermint/abci/server"
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -17,11 +17,11 @@ func main() {
|
||||||
// Start the listener
|
// Start the listener
|
||||||
srv, err := server.NewServer(*addrPtr, *abciPtr, NewChainAwareApplication())
|
srv, err := server.NewServer(*addrPtr, *abciPtr, NewChainAwareApplication())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
common.Exit(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait forever
|
// Wait forever
|
||||||
TrapSignal(func() {
|
common.TrapSignal(func() {
|
||||||
// Cleanup
|
// Cleanup
|
||||||
srv.Stop()
|
srv.Stop()
|
||||||
})
|
})
|
||||||
|
@ -58,7 +58,7 @@ func (app *ChainAwareApplication) Commit() types.Result {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *ChainAwareApplication) Query(query []byte) types.Result {
|
func (app *ChainAwareApplication) Query(query []byte) types.Result {
|
||||||
return types.NewResultOK([]byte(Fmt("%d,%d", app.beginCount, app.endCount)), "")
|
return types.NewResultOK([]byte(common.Fmt("%d,%d", app.beginCount, app.endCount)), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *ChainAwareApplication) BeginBlock(hash []byte, header *types.Header) {
|
func (app *ChainAwareApplication) BeginBlock(hash []byte, header *types.Header) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/tendermint/abci/client"
|
"github.com/tendermint/abci/client"
|
||||||
"github.com/tendermint/abci/server"
|
"github.com/tendermint/abci/server"
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChainAware(t *testing.T) {
|
func TestChainAware(t *testing.T) {
|
||||||
|
@ -25,7 +25,7 @@ func TestChainAware(t *testing.T) {
|
||||||
// Connect to the socket
|
// Connect to the socket
|
||||||
client, err := abcicli.NewSocketClient("unix://test.sock", false)
|
client, err := abcicli.NewSocketClient("unix://test.sock", false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(Fmt("Error starting socket client: %v", err.Error()))
|
common.Exit(Fmt("Error starting socket client: %v", err.Error()))
|
||||||
}
|
}
|
||||||
client.Start()
|
client.Start()
|
||||||
defer client.Stop()
|
defer client.Stop()
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CounterApplication struct {
|
type CounterApplication struct {
|
||||||
|
@ -18,7 +18,7 @@ func NewCounterApplication(serial bool) *CounterApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *CounterApplication) Info() types.ResponseInfo {
|
func (app *CounterApplication) Info() types.ResponseInfo {
|
||||||
return types.ResponseInfo{Data: Fmt("{\"hashes\":%v,\"txs\":%v}", app.hashCount, app.txCount)}
|
return types.ResponseInfo{Data: common.Fmt("{\"hashes\":%v,\"txs\":%v}", app.hashCount, app.txCount)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *CounterApplication) SetOption(key string, value string) (log string) {
|
func (app *CounterApplication) SetOption(key string, value string) (log string) {
|
||||||
|
@ -31,13 +31,13 @@ func (app *CounterApplication) SetOption(key string, value string) (log string)
|
||||||
func (app *CounterApplication) DeliverTx(tx []byte) types.Result {
|
func (app *CounterApplication) DeliverTx(tx []byte) types.Result {
|
||||||
if app.serial {
|
if app.serial {
|
||||||
if len(tx) > 8 {
|
if len(tx) > 8 {
|
||||||
return types.ErrEncodingError.SetLog(Fmt("Max tx size is 8 bytes, got %d", len(tx)))
|
return types.ErrEncodingError.SetLog(common.Fmt("Max tx size is 8 bytes, got %d", len(tx)))
|
||||||
}
|
}
|
||||||
tx8 := make([]byte, 8)
|
tx8 := make([]byte, 8)
|
||||||
copy(tx8[len(tx8)-len(tx):], tx)
|
copy(tx8[len(tx8)-len(tx):], tx)
|
||||||
txValue := binary.BigEndian.Uint64(tx8)
|
txValue := binary.BigEndian.Uint64(tx8)
|
||||||
if txValue != uint64(app.txCount) {
|
if txValue != uint64(app.txCount) {
|
||||||
return types.ErrBadNonce.SetLog(Fmt("Invalid nonce. Expected %v, got %v", app.txCount, txValue))
|
return types.ErrBadNonce.SetLog(common.Fmt("Invalid nonce. Expected %v, got %v", app.txCount, txValue))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.txCount += 1
|
app.txCount += 1
|
||||||
|
@ -47,13 +47,13 @@ func (app *CounterApplication) DeliverTx(tx []byte) types.Result {
|
||||||
func (app *CounterApplication) CheckTx(tx []byte) types.Result {
|
func (app *CounterApplication) CheckTx(tx []byte) types.Result {
|
||||||
if app.serial {
|
if app.serial {
|
||||||
if len(tx) > 8 {
|
if len(tx) > 8 {
|
||||||
return types.ErrEncodingError.SetLog(Fmt("Max tx size is 8 bytes, got %d", len(tx)))
|
return types.ErrEncodingError.SetLog(common.Fmt("Max tx size is 8 bytes, got %d", len(tx)))
|
||||||
}
|
}
|
||||||
tx8 := make([]byte, 8)
|
tx8 := make([]byte, 8)
|
||||||
copy(tx8[len(tx8)-len(tx):], tx)
|
copy(tx8[len(tx8)-len(tx):], tx)
|
||||||
txValue := binary.BigEndian.Uint64(tx8)
|
txValue := binary.BigEndian.Uint64(tx8)
|
||||||
if txValue < uint64(app.txCount) {
|
if txValue < uint64(app.txCount) {
|
||||||
return types.ErrBadNonce.SetLog(Fmt("Invalid nonce. Expected >= %v, got %v", app.txCount, txValue))
|
return types.ErrBadNonce.SetLog(common.Fmt("Invalid nonce. Expected >= %v, got %v", app.txCount, txValue))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return types.OK
|
return types.OK
|
||||||
|
@ -76,10 +76,10 @@ func (app *CounterApplication) Query(query []byte) types.Result {
|
||||||
|
|
||||||
switch queryStr {
|
switch queryStr {
|
||||||
case "hash":
|
case "hash":
|
||||||
return types.NewResultOK(nil, Fmt("%v", app.hashCount))
|
return types.NewResultOK(nil, common.Fmt("%v", app.hashCount))
|
||||||
case "tx":
|
case "tx":
|
||||||
return types.NewResultOK(nil, Fmt("%v", app.txCount))
|
return types.NewResultOK(nil, common.Fmt("%v", app.txCount))
|
||||||
}
|
}
|
||||||
|
|
||||||
return types.ErrUnknownRequest.SetLog(Fmt("Invalid nonce. Expected hash or tx, got %v", queryStr))
|
return types.ErrUnknownRequest.SetLog(common.Fmt("Invalid nonce. Expected hash or tx, got %v", queryStr))
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
"github.com/tendermint/go-merkle"
|
"github.com/tendermint/go-merkle"
|
||||||
"github.com/tendermint/go-wire"
|
"github.com/tendermint/go-wire"
|
||||||
)
|
)
|
||||||
|
@ -20,7 +20,7 @@ func NewDummyApplication() *DummyApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *DummyApplication) Info() (resInfo types.ResponseInfo) {
|
func (app *DummyApplication) Info() (resInfo types.ResponseInfo) {
|
||||||
return types.ResponseInfo{Data: Fmt("{\"size\":%v}", app.state.Size())}
|
return types.ResponseInfo{Data: common.Fmt("{\"size\":%v}", app.state.Size())}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *DummyApplication) SetOption(key string, value string) (log string) {
|
func (app *DummyApplication) SetOption(key string, value string) (log string) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
"github.com/tendermint/go-crypto"
|
"github.com/tendermint/go-crypto"
|
||||||
"github.com/tendermint/go-wire"
|
"github.com/tendermint/go-wire"
|
||||||
)
|
)
|
||||||
|
@ -107,8 +107,8 @@ func TestValSetChanges(t *testing.T) {
|
||||||
nInit := 5
|
nInit := 5
|
||||||
vals := make([]*types.Validator, total)
|
vals := make([]*types.Validator, total)
|
||||||
for i := 0; i < total; i++ {
|
for i := 0; i < total; i++ {
|
||||||
pubkey := crypto.GenPrivKeyEd25519FromSecret([]byte(Fmt("test%d", i))).PubKey().Bytes()
|
pubkey := crypto.GenPrivKeyEd25519FromSecret([]byte(common.Fmt("test%d", i))).PubKey().Bytes()
|
||||||
power := RandInt()
|
power := common.RandInt()
|
||||||
vals[i] = &types.Validator{pubkey, uint64(power)}
|
vals[i] = &types.Validator{pubkey, uint64(power)}
|
||||||
}
|
}
|
||||||
// iniitalize with the first nInit
|
// iniitalize with the first nInit
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
dbm "github.com/tendermint/go-db"
|
dbm "github.com/tendermint/go-db"
|
||||||
"github.com/tendermint/go-merkle"
|
"github.com/tendermint/go-merkle"
|
||||||
"github.com/tendermint/go-wire"
|
"github.com/tendermint/go-wire"
|
||||||
|
@ -135,7 +135,7 @@ func LoadLastBlock(db dbm.DB) (lastBlock LastBlockInfo) {
|
||||||
wire.ReadBinaryPtr(&lastBlock, r, 0, n, err)
|
wire.ReadBinaryPtr(&lastBlock, r, 0, n, err)
|
||||||
if *err != nil {
|
if *err != nil {
|
||||||
// DATA HAS BEEN CORRUPTED OR THE SPEC HAS CHANGED
|
// DATA HAS BEEN CORRUPTED OR THE SPEC HAS CHANGED
|
||||||
Exit(Fmt("Data has been corrupted or its spec has changed: %v\n", *err))
|
common.Exit(common.Fmt("Data has been corrupted or its spec has changed: %v\n", *err))
|
||||||
}
|
}
|
||||||
// TODO: ensure that buf is completely read.
|
// TODO: ensure that buf is completely read.
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ func SaveLastBlock(db dbm.DB, lastBlock LastBlockInfo) {
|
||||||
wire.WriteBinary(lastBlock, buf, n, err)
|
wire.WriteBinary(lastBlock, buf, n, err)
|
||||||
if *err != nil {
|
if *err != nil {
|
||||||
// TODO
|
// TODO
|
||||||
PanicCrisis(*err)
|
common.PanicCrisis(*err)
|
||||||
}
|
}
|
||||||
db.Set(lastBlockKey, buf.Bytes())
|
db.Set(lastBlockKey, buf.Bytes())
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ func (app *PersistentDummyApplication) Validators() (validators []*types.Validat
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeValSetChangeTx(pubkey []byte, power uint64) []byte {
|
func MakeValSetChangeTx(pubkey []byte, power uint64) []byte {
|
||||||
return []byte(Fmt("val:%X/%d", pubkey, power))
|
return []byte(common.Fmt("val:%X/%d", pubkey, power))
|
||||||
}
|
}
|
||||||
|
|
||||||
func isValidatorTx(tx []byte) bool {
|
func isValidatorTx(tx []byte) bool {
|
||||||
|
@ -188,16 +188,16 @@ func (app *PersistentDummyApplication) execValidatorTx(tx []byte) types.Result {
|
||||||
tx = tx[len(ValidatorSetChangePrefix):]
|
tx = tx[len(ValidatorSetChangePrefix):]
|
||||||
pubKeyAndPower := strings.Split(string(tx), "/")
|
pubKeyAndPower := strings.Split(string(tx), "/")
|
||||||
if len(pubKeyAndPower) != 2 {
|
if len(pubKeyAndPower) != 2 {
|
||||||
return types.ErrEncodingError.SetLog(Fmt("Expected 'pubkey/power'. Got %v", pubKeyAndPower))
|
return types.ErrEncodingError.SetLog(common.Fmt("Expected 'pubkey/power'. Got %v", pubKeyAndPower))
|
||||||
}
|
}
|
||||||
pubkeyS, powerS := pubKeyAndPower[0], pubKeyAndPower[1]
|
pubkeyS, powerS := pubKeyAndPower[0], pubKeyAndPower[1]
|
||||||
pubkey, err := hex.DecodeString(pubkeyS)
|
pubkey, err := hex.DecodeString(pubkeyS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.ErrEncodingError.SetLog(Fmt("Pubkey (%s) is invalid hex", pubkeyS))
|
return types.ErrEncodingError.SetLog(common.Fmt("Pubkey (%s) is invalid hex", pubkeyS))
|
||||||
}
|
}
|
||||||
power, err := strconv.Atoi(powerS)
|
power, err := strconv.Atoi(powerS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.ErrEncodingError.SetLog(Fmt("Power (%s) is not an int", powerS))
|
return types.ErrEncodingError.SetLog(common.Fmt("Power (%s) is not an int", powerS))
|
||||||
}
|
}
|
||||||
|
|
||||||
// update
|
// update
|
||||||
|
@ -210,14 +210,14 @@ func (app *PersistentDummyApplication) updateValidator(v *types.Validator) types
|
||||||
if v.Power == 0 {
|
if v.Power == 0 {
|
||||||
// remove validator
|
// remove validator
|
||||||
if !app.app.state.Has(key) {
|
if !app.app.state.Has(key) {
|
||||||
return types.ErrUnauthorized.SetLog(Fmt("Cannot remove non-existent validator %X", key))
|
return types.ErrUnauthorized.SetLog(common.Fmt("Cannot remove non-existent validator %X", key))
|
||||||
}
|
}
|
||||||
app.app.state.Remove(key)
|
app.app.state.Remove(key)
|
||||||
} else {
|
} else {
|
||||||
// add or update validator
|
// add or update validator
|
||||||
value := bytes.NewBuffer(make([]byte, 0))
|
value := bytes.NewBuffer(make([]byte, 0))
|
||||||
if err := types.WriteMessage(v, value); err != nil {
|
if err := types.WriteMessage(v, value); err != nil {
|
||||||
return types.ErrInternalError.SetLog(Fmt("Error encoding validator: %v", err))
|
return types.ErrInternalError.SetLog(common.Fmt("Error encoding validator: %v", err))
|
||||||
}
|
}
|
||||||
app.app.state.Set(key, value.Bytes())
|
app.app.state.Set(key, value.Bytes())
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,15 +7,16 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/tendermint/abci/client"
|
"github.com/tendermint/abci/client"
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/dummy"
|
||||||
nilapp "github.com/tendermint/abci/example/nil"
|
nilapp "github.com/tendermint/abci/example/nil"
|
||||||
"github.com/tendermint/abci/server"
|
"github.com/tendermint/abci/server"
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDummy(t *testing.T) {
|
func TestDummy(t *testing.T) {
|
||||||
|
@ -40,14 +41,14 @@ func testStream(t *testing.T, app types.Application) {
|
||||||
// Start the listener
|
// Start the listener
|
||||||
server, err := server.NewSocketServer("unix://test.sock", app)
|
server, err := server.NewSocketServer("unix://test.sock", app)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(Fmt("Error starting socket server: %v", err.Error()))
|
common.Exit(common.Fmt("Error starting socket server: %v", err.Error()))
|
||||||
}
|
}
|
||||||
defer server.Stop()
|
defer server.Stop()
|
||||||
|
|
||||||
// Connect to the socket
|
// Connect to the socket
|
||||||
client, err := abcicli.NewSocketClient("unix://test.sock", false)
|
client, err := abcicli.NewSocketClient("unix://test.sock", false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(Fmt("Error starting socket client: %v", err.Error()))
|
common.Exit(common.Fmt("Error starting socket client: %v", err.Error()))
|
||||||
}
|
}
|
||||||
client.Start()
|
client.Start()
|
||||||
defer client.Stop()
|
defer client.Stop()
|
||||||
|
@ -113,14 +114,14 @@ func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
|
||||||
// Start the listener
|
// Start the listener
|
||||||
server, err := server.NewGRPCServer("unix://test.sock", app)
|
server, err := server.NewGRPCServer("unix://test.sock", app)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(Fmt("Error starting GRPC server: %v", err.Error()))
|
common.Exit(common.Fmt("Error starting GRPC server: %v", err.Error()))
|
||||||
}
|
}
|
||||||
defer server.Stop()
|
defer server.Stop()
|
||||||
|
|
||||||
// Connect to the socket
|
// Connect to the socket
|
||||||
conn, err := grpc.Dial("unix://test.sock", grpc.WithInsecure(), grpc.WithDialer(dialerFunc))
|
conn, err := grpc.Dial("unix://test.sock", grpc.WithInsecure(), grpc.WithDialer(dialerFunc))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(Fmt("Error dialing GRPC server: %v", err.Error()))
|
common.Exit(common.Fmt("Error dialing GRPC server: %v", err.Error()))
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,13 @@ import (
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// var maxNumberConnections = 2
|
// var maxNumberConnections = 2
|
||||||
|
|
||||||
type GRPCServer struct {
|
type GRPCServer struct {
|
||||||
BaseService
|
common.BaseService
|
||||||
|
|
||||||
proto string
|
proto string
|
||||||
addr string
|
addr string
|
||||||
|
@ -23,7 +23,7 @@ type GRPCServer struct {
|
||||||
app types.ABCIApplicationServer
|
app types.ABCIApplicationServer
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) (Service, error) {
|
func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) (common.Service, error) {
|
||||||
parts := strings.SplitN(protoAddr, "://", 2)
|
parts := strings.SplitN(protoAddr, "://", 2)
|
||||||
proto, addr := parts[0], parts[1]
|
proto, addr := parts[0], parts[1]
|
||||||
s := &GRPCServer{
|
s := &GRPCServer{
|
||||||
|
@ -32,7 +32,7 @@ func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) (Service,
|
||||||
listener: nil,
|
listener: nil,
|
||||||
app: app,
|
app: app,
|
||||||
}
|
}
|
||||||
s.BaseService = *NewBaseService(nil, "ABCIServer", s)
|
s.BaseService = *common.NewBaseService(nil, "ABCIServer", s)
|
||||||
_, err := s.Start() // Just start it
|
_, err := s.Start() // Just start it
|
||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewServer(protoAddr, transport string, app types.Application) (Service, error) {
|
func NewServer(protoAddr, transport string, app types.Application) (common.Service, error) {
|
||||||
var s Service
|
var s common.Service
|
||||||
var err error
|
var err error
|
||||||
switch transport {
|
switch transport {
|
||||||
case "socket":
|
case "socket":
|
||||||
|
|
|
@ -9,13 +9,13 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// var maxNumberConnections = 2
|
// var maxNumberConnections = 2
|
||||||
|
|
||||||
type SocketServer struct {
|
type SocketServer struct {
|
||||||
BaseService
|
common.BaseService
|
||||||
|
|
||||||
proto string
|
proto string
|
||||||
addr string
|
addr string
|
||||||
|
@ -29,7 +29,7 @@ type SocketServer struct {
|
||||||
app types.Application
|
app types.Application
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSocketServer(protoAddr string, app types.Application) (Service, error) {
|
func NewSocketServer(protoAddr string, app types.Application) (common.Service, error) {
|
||||||
parts := strings.SplitN(protoAddr, "://", 2)
|
parts := strings.SplitN(protoAddr, "://", 2)
|
||||||
proto, addr := parts[0], parts[1]
|
proto, addr := parts[0], parts[1]
|
||||||
s := &SocketServer{
|
s := &SocketServer{
|
||||||
|
@ -39,7 +39,7 @@ func NewSocketServer(protoAddr string, app types.Application) (Service, error) {
|
||||||
app: app,
|
app: app,
|
||||||
conns: make(map[int]net.Conn),
|
conns: make(map[int]net.Conn),
|
||||||
}
|
}
|
||||||
s.BaseService = *NewBaseService(nil, "ABCIServer", s)
|
s.BaseService = *common.NewBaseService(nil, "ABCIServer", s)
|
||||||
_, err := s.Start() // Just start it
|
_, err := s.Start() // Just start it
|
||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ func (s *SocketServer) acceptConnectionsRoutine() {
|
||||||
if !s.IsRunning() {
|
if !s.IsRunning() {
|
||||||
return // Ignore error from listener closing.
|
return // Ignore error from listener closing.
|
||||||
}
|
}
|
||||||
Exit("Failed to accept connection: " + err.Error())
|
common.Exit("Failed to accept connection: " + err.Error())
|
||||||
} else {
|
} else {
|
||||||
log.Notice("Accepted a new connection")
|
log.Notice("Accepted a new connection")
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,17 +3,16 @@ package main
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
//"encoding/hex"
|
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
conn, err := Connect("unix://test.sock")
|
conn, err := common.Connect("unix://test.sock")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
common.Exit(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read a bunch of responses
|
// Read a bunch of responses
|
||||||
|
@ -23,7 +22,7 @@ func main() {
|
||||||
var res = &types.Response{}
|
var res = &types.Response{}
|
||||||
err := types.ReadMessage(conn, res)
|
err := types.ReadMessage(conn, res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
common.Exit(err.Error())
|
||||||
}
|
}
|
||||||
counter += 1
|
counter += 1
|
||||||
if counter%1000 == 0 {
|
if counter%1000 == 0 {
|
||||||
|
@ -40,11 +39,11 @@ func main() {
|
||||||
|
|
||||||
err := types.WriteMessage(req, bufWriter)
|
err := types.WriteMessage(req, bufWriter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
common.Exit(err.Error())
|
||||||
}
|
}
|
||||||
err = bufWriter.Flush()
|
err = bufWriter.Flush()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
common.Exit(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
counter += 1
|
counter += 1
|
||||||
|
|
|
@ -6,17 +6,16 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"reflect"
|
"reflect"
|
||||||
//"encoding/hex"
|
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
conn, err := Connect("unix://test.sock")
|
conn, err := common.Connect("unix://test.sock")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
common.Exit(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make a bunch of requests
|
// Make a bunch of requests
|
||||||
|
@ -25,7 +24,7 @@ func main() {
|
||||||
req := types.ToRequestEcho("foobar")
|
req := types.ToRequestEcho("foobar")
|
||||||
_, err := makeRequest(conn, req)
|
_, err := makeRequest(conn, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit(err.Error())
|
common.Exit(err.Error())
|
||||||
}
|
}
|
||||||
counter += 1
|
counter += 1
|
||||||
if counter%1000 == 0 {
|
if counter%1000 == 0 {
|
||||||
|
@ -63,7 +62,7 @@ func makeRequest(conn net.Conn, req *types.Request) (*types.Response, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if _, ok := resFlush.Value.(*types.Response_Flush); !ok {
|
if _, ok := resFlush.Value.(*types.Response_Flush); !ok {
|
||||||
return nil, errors.New(Fmt("Expected flush response but got something else: %v", reflect.TypeOf(resFlush)))
|
return nil, errors.New(common.Fmt("Expected flush response but got something else: %v", reflect.TypeOf(resFlush)))
|
||||||
}
|
}
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/tendermint/abci/client"
|
"github.com/tendermint/abci/client"
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
common "github.com/tendermint/go-common"
|
||||||
"github.com/tendermint/go-process"
|
"github.com/tendermint/go-process"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ func SetOption(client abcicli.Client, key, value string) {
|
||||||
res := client.SetOptionSync(key, value)
|
res := client.SetOptionSync(key, value)
|
||||||
_, _, log := res.Code, res.Data, res.Log
|
_, _, log := res.Code, res.Data, res.Log
|
||||||
if res.IsErr() {
|
if res.IsErr() {
|
||||||
panic(Fmt("setting %v=%v: \nlog: %v", key, value, log))
|
panic(common.Fmt("setting %v=%v: \nlog: %v", key, value, log))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,10 +54,10 @@ func Commit(client abcicli.Client, hashExp []byte) {
|
||||||
res := client.CommitSync()
|
res := client.CommitSync()
|
||||||
_, data, log := res.Code, res.Data, res.Log
|
_, data, log := res.Code, res.Data, res.Log
|
||||||
if res.IsErr() {
|
if res.IsErr() {
|
||||||
panic(Fmt("committing %v\nlog: %v", log))
|
panic(common.Fmt("committing %v\nlog: %v", log))
|
||||||
}
|
}
|
||||||
if !bytes.Equal(res.Data, hashExp) {
|
if !bytes.Equal(res.Data, hashExp) {
|
||||||
panic(Fmt("Commit hash was unexpected. Got %X expected %X",
|
panic(common.Fmt("Commit hash was unexpected. Got %X expected %X",
|
||||||
data, hashExp))
|
data, hashExp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,11 +66,11 @@ func DeliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, da
|
||||||
res := client.DeliverTxSync(txBytes)
|
res := client.DeliverTxSync(txBytes)
|
||||||
code, data, log := res.Code, res.Data, res.Log
|
code, data, log := res.Code, res.Data, res.Log
|
||||||
if code != codeExp {
|
if code != codeExp {
|
||||||
panic(Fmt("DeliverTx response code was unexpected. Got %v expected %v. Log: %v",
|
panic(common.Fmt("DeliverTx response code was unexpected. Got %v expected %v. Log: %v",
|
||||||
code, codeExp, log))
|
code, codeExp, log))
|
||||||
}
|
}
|
||||||
if !bytes.Equal(data, dataExp) {
|
if !bytes.Equal(data, dataExp) {
|
||||||
panic(Fmt("DeliverTx response data was unexpected. Got %X expected %X",
|
panic(common.Fmt("DeliverTx response data was unexpected. Got %X expected %X",
|
||||||
data, dataExp))
|
data, dataExp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,14 +79,14 @@ func CheckTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, data
|
||||||
res := client.CheckTxSync(txBytes)
|
res := client.CheckTxSync(txBytes)
|
||||||
code, data, log := res.Code, res.Data, res.Log
|
code, data, log := res.Code, res.Data, res.Log
|
||||||
if res.IsErr() {
|
if res.IsErr() {
|
||||||
panic(Fmt("checking tx %X: %v\nlog: %v", txBytes, log))
|
panic(common.Fmt("checking tx %X: %v\nlog: %v", txBytes, log))
|
||||||
}
|
}
|
||||||
if code != codeExp {
|
if code != codeExp {
|
||||||
panic(Fmt("CheckTx response code was unexpected. Got %v expected %v. Log: %v",
|
panic(common.Fmt("CheckTx response code was unexpected. Got %v expected %v. Log: %v",
|
||||||
code, codeExp, log))
|
code, codeExp, log))
|
||||||
}
|
}
|
||||||
if !bytes.Equal(data, dataExp) {
|
if !bytes.Equal(data, dataExp) {
|
||||||
panic(Fmt("CheckTx response data was unexpected. Got %X expected %X",
|
panic(common.Fmt("CheckTx response data was unexpected. Got %X expected %X",
|
||||||
data, dataExp))
|
data, dataExp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue