Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev' of https://github.com/Bytom/bytom into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
gguoss committed Oct 21, 2017
2 parents bb8198b + c664a74 commit d331652
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
8 changes: 6 additions & 2 deletions blockchain/hsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package blockchain

import (
"context"

"github.com/bytom/blockchain/pseudohsm"
"github.com/bytom/blockchain/txbuilder"
"github.com/bytom/crypto/ed25519/chainkd"
"github.com/bytom/net/http/httperror"
"github.com/bytom/net/http/httpjson"
log "github.com/sirupsen/logrus"
)

func init() {
Expand Down Expand Up @@ -55,17 +57,19 @@ func (a *BlockchainReactor) pseudohsmSignTemplates(ctx context.Context, x struct
Auth string
Txs []*txbuilder.Template `json:"transactions"`
XPubs []chainkd.XPub `json:"xpubs"`
}) []interface{} {
resp := make([]interface{}, 0, len(x.Txs))
}) interface{} {
resp := make([]interface{}, len(x.Txs))
for _, tx := range x.Txs {
err := txbuilder.Sign(ctx, tx, x.XPubs, x.Auth, a.pseudohsmSignTemplate)
log.WithFields(log.Fields{"tx": tx, "build err": err}).Info("After sign transaction.")
if err != nil {
info := errorFormatter.Format(err)
resp = append(resp, info)
} else {
resp = append(resp, tx)
}
}
log.WithField("resp", resp).Info("Sign Transaction complete.")
return resp
}

Expand Down
7 changes: 4 additions & 3 deletions cmd/bytomcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -984,11 +984,12 @@ func signTransactions(client *rpc.Client, args []string) {
file, _ := os.Open(args[0])
tpl_byte := make([]byte, 10000)
file.Read(tpl_byte)
fmt.Printf("tpl:%v\n", string(tpl_byte))
stdjson.Unmarshal(tpl_byte, &tpl)
fmt.Printf("tpl_byte:%v\n", string(tpl_byte))
err = stdjson.Unmarshal(bytes.Trim(tpl_byte, "\x00"), &tpl)
fmt.Printf("tpl:%v, err:%v\n", tpl, err)
in.Txs = []*txbuilder.Template{&tpl}

var response map[string][]interface{}
var response []interface{} = make([]interface{}, 1)
client.Call(context.Background(), "/sign-transactions", &in, &response)
fmt.Printf("sign response:%v\n", response)
}
Expand Down
2 changes: 1 addition & 1 deletion net/http/httperror/httperror.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (f Formatter) Log(ctx context.Context, err error) {
resp := f.Format(err)
keyvals := []interface{}{
"status", resp.HTTPStatus,
"chaincode", resp.ChainCode,
"bytomcode", resp.ChainCode,
"path", reqid.PathFromContext(ctx),
log.KeyError, errorMessage,
}
Expand Down
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func (n *Node) makeNodeInfo() *p2p.NodeInfo {
nodeInfo := &p2p.NodeInfo{
PubKey: n.privKey.PubKey().Unwrap().(crypto.PubKeyEd25519),
Moniker: n.config.Moniker,
Network: "chain0",
Network: "bytom",
Version: version.Version,
Other: []string{
cmn.Fmt("wire_version=%v", wire.Version),
Expand Down
6 changes: 3 additions & 3 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package version

const Maj = "0"
const Min = "5"
const Fix = "0"
const Min = "1"
const Fix = "2"

var (
// The full version string
Version = "0.5.0"
Version = "0.1.2"

// GitCommit is set with --ldflags "-X main.gitCommit=$(git rev-parse HEAD)"
GitCommit string
Expand Down

0 comments on commit d331652

Please sign in to comment.