Add Network to SignBytes, to prevent network clashes

This commit is contained in:
Jae Kwon
2015-04-20 23:59:52 -07:00
parent 733dfcf4ad
commit 2ba6f86f2e
9 changed files with 51 additions and 40 deletions
+6
View File
@@ -7,6 +7,7 @@ import (
"github.com/tendermint/tendermint/account"
"github.com/tendermint/tendermint/binary"
. "github.com/tendermint/tendermint/common"
"github.com/tendermint/tendermint/config"
)
var (
@@ -133,6 +134,7 @@ type SendTx struct {
}
func (tx *SendTx) WriteSignBytes(w io.Writer, n *int64, err *error) {
binary.WriteString(config.App().GetString("Network"), w, n, err)
binary.WriteUvarint(uint(len(tx.Inputs)), w, n, err)
for _, in := range tx.Inputs {
in.WriteSignBytes(w, n, err)
@@ -158,6 +160,7 @@ type CallTx struct {
}
func (tx *CallTx) WriteSignBytes(w io.Writer, n *int64, err *error) {
binary.WriteString(config.App().GetString("Network"), w, n, err)
tx.Input.WriteSignBytes(w, n, err)
binary.WriteByteSlice(tx.Address, w, n, err)
binary.WriteUint64(tx.GasLimit, w, n, err)
@@ -178,6 +181,7 @@ type BondTx struct {
}
func (tx *BondTx) WriteSignBytes(w io.Writer, n *int64, err *error) {
binary.WriteString(config.App().GetString("Network"), w, n, err)
binary.WriteBinary(tx.PubKey, w, n, err)
binary.WriteUvarint(uint(len(tx.Inputs)), w, n, err)
for _, in := range tx.Inputs {
@@ -202,6 +206,7 @@ type UnbondTx struct {
}
func (tx *UnbondTx) WriteSignBytes(w io.Writer, n *int64, err *error) {
binary.WriteString(config.App().GetString("Network"), w, n, err)
binary.WriteByteSlice(tx.Address, w, n, err)
binary.WriteUvarint(tx.Height, w, n, err)
}
@@ -219,6 +224,7 @@ type RebondTx struct {
}
func (tx *RebondTx) WriteSignBytes(w io.Writer, n *int64, err *error) {
binary.WriteString(config.App().GetString("Network"), w, n, err)
binary.WriteByteSlice(tx.Address, w, n, err)
binary.WriteUvarint(tx.Height, w, n, err)
}
+2
View File
@@ -8,6 +8,7 @@ import (
"github.com/tendermint/tendermint/account"
"github.com/tendermint/tendermint/binary"
. "github.com/tendermint/tendermint/common"
"github.com/tendermint/tendermint/config"
)
var (
@@ -46,6 +47,7 @@ const (
)
func (vote *Vote) WriteSignBytes(w io.Writer, n *int64, err *error) {
binary.WriteString(config.App().GetString("Network"), w, n, err)
binary.WriteUvarint(vote.Height, w, n, err)
binary.WriteUvarint(vote.Round, w, n, err)
binary.WriteByte(vote.Type, w, n, err)