From 6062b06aa99015fefadad19b27313cfa8b233c02 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Mon, 1 Jun 2015 17:49:24 -0700 Subject: [PATCH] fixed NameTx.WriteSignBytes() bug. --- state/execution.go | 4 ++-- types/tx.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/state/execution.go b/state/execution.go index 83cbea422..c2edef8b3 100644 --- a/state/execution.go +++ b/state/execution.go @@ -356,7 +356,7 @@ func ExecTx(blockCache *BlockCache, tx_ types.Tx, runCall bool, evc events.Firea signBytes := account.SignBytes(_s.ChainID, tx) err := validateInput(inAcc, signBytes, tx.Input) if err != nil { - log.Debug(Fmt("validateInput failed on %X:", tx.Input.Address)) + log.Debug(Fmt("validateInput failed on %X: %v", tx.Input.Address, err)) return err } if tx.Input.Amount < tx.Fee { @@ -495,7 +495,7 @@ func ExecTx(blockCache *BlockCache, tx_ types.Tx, runCall bool, evc events.Firea signBytes := account.SignBytes(_s.ChainID, tx) err := validateInput(inAcc, signBytes, tx.Input) if err != nil { - log.Debug(Fmt("validateInput failed on %X:", tx.Input.Address)) + log.Debug(Fmt("validateInput failed on %X: %v", tx.Input.Address, err)) return err } // fee is in addition to the amount which is used to determine the TTL diff --git a/types/tx.go b/types/tx.go index 19274e955..46362413b 100644 --- a/types/tx.go +++ b/types/tx.go @@ -192,7 +192,7 @@ type NameTx struct { func (tx *NameTx) WriteSignBytes(chainID string, w io.Writer, n *int64, err *error) { binary.WriteTo([]byte(Fmt(`{"chain_id":%s`, jsonEscape(chainID))), w, n, err) binary.WriteTo([]byte(Fmt(`,"tx":[%v,{"data":%s,"fee":%v`, TxTypeName, jsonEscape(tx.Data), tx.Fee)), w, n, err) - binary.WriteTo([]byte(Fmt(`,"input":`, tx.Input)), w, n, err) + binary.WriteTo([]byte(`,"input":`), w, n, err) tx.Input.WriteSignBytes(w, n, err) binary.WriteTo([]byte(Fmt(`,"name":%s`, jsonEscape(tx.Name))), w, n, err) binary.WriteTo([]byte(`}]}`), w, n, err)