Start on coin handler
This commit is contained in:
+17
-3
@@ -1,9 +1,13 @@
|
||||
package stack
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/tendermint/basecoin"
|
||||
"github.com/tendermint/basecoin/txs"
|
||||
"github.com/tendermint/basecoin/types"
|
||||
wire "github.com/tendermint/go-wire"
|
||||
"github.com/tendermint/go-wire/data"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -45,7 +49,17 @@ func runAll(ctx basecoin.Context, store types.KVStore, txs []basecoin.Tx, next b
|
||||
return combine(rs), nil
|
||||
}
|
||||
|
||||
func combine(res []basecoin.Result) basecoin.Result {
|
||||
// TODO: how to combine???
|
||||
return res[0]
|
||||
// combines all data bytes as a go-wire array.
|
||||
// joins all log messages with \n
|
||||
func combine(all []basecoin.Result) basecoin.Result {
|
||||
datas := make([]data.Bytes, len(all))
|
||||
logs := make([]string, len(all))
|
||||
for i, r := range all {
|
||||
datas[i] = r.Data
|
||||
logs[i] = r.Log
|
||||
}
|
||||
return basecoin.Result{
|
||||
Data: wire.BinaryBytes(datas),
|
||||
Log: strings.Join(logs, "\n"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user