diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-07-06 20:00:17 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-07-06 20:00:17 +0800 |
commit | cc29b4bc27bf8f05ea863658e3627ee3c019e318 (patch) | |
tree | 7780b142547c121d9ada914b6bedce86777636cd | |
parent | 457a3c8f7691314b30909787b952fccebf7f38df (diff) | |
parent | 4f7fc7b23f50f3fba4e2fb6815738c4ec2c8fe0a (diff) | |
download | go-tangerine-cc29b4bc27bf8f05ea863658e3627ee3c019e318.tar.gz go-tangerine-cc29b4bc27bf8f05ea863658e3627ee3c019e318.tar.zst go-tangerine-cc29b4bc27bf8f05ea863658e3627ee3c019e318.zip |
Merge pull request #1413 from obscuren/receipt-fix
rpc, xeth: fixed returned tx hash & receipt logs
-rw-r--r-- | rpc/api/parsing.go | 23 | ||||
-rw-r--r-- | xeth/xeth.go | 2 |
2 files changed, 15 insertions, 10 deletions
diff --git a/rpc/api/parsing.go b/rpc/api/parsing.go index 4209ea7e3..8e25ffffb 100644 --- a/rpc/api/parsing.go +++ b/rpc/api/parsing.go @@ -404,14 +404,14 @@ func NewUncleRes(h *types.Header) *UncleRes { // } type ReceiptRes struct { - TransactionHash *hexdata `json:transactionHash` - TransactionIndex *hexnum `json:transactionIndex` - BlockNumber *hexnum `json:blockNumber` - BlockHash *hexdata `json:blockHash` - CumulativeGasUsed *hexnum `json:cumulativeGasUsed` - GasUsed *hexnum `json:gasUsed` - ContractAddress *hexdata `json:contractAddress` - Logs *[]interface{} `json:logs` + TransactionHash *hexdata `json:"transactionHash"` + TransactionIndex *hexnum `json:"transactionIndex"` + BlockNumber *hexnum `json:"blockNumber"` + BlockHash *hexdata `json:"blockHash"` + CumulativeGasUsed *hexnum `json:"cumulativeGasUsed"` + GasUsed *hexnum `json:"gasUsed"` + ContractAddress *hexdata `json:"contractAddress"` + Logs *[]interface{} `json:"logs"` } func NewReceiptRes(rec *types.Receipt) *ReceiptRes { @@ -430,7 +430,12 @@ func NewReceiptRes(rec *types.Receipt) *ReceiptRes { if bytes.Compare(rec.ContractAddress.Bytes(), bytes.Repeat([]byte{0}, 20)) != 0 { v.ContractAddress = newHexData(rec.ContractAddress) } - // v.Logs = rec.Logs() + + logs := make([]interface{}, len(rec.Logs())) + for i, log := range rec.Logs() { + logs[i] = NewLogRes(log) + } + v.Logs = &logs return v } diff --git a/xeth/xeth.go b/xeth/xeth.go index 4bd18a2f6..f2295e6e1 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -973,7 +973,7 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS glog.V(logger.Info).Infof("Tx(%x) to: %x\n", tx.Hash(), tx.To()) } - return tx.Hash().Hex(), nil + return signed.Hash().Hex(), nil } func (self *XEth) sign(tx *types.Transaction, from common.Address, didUnlock bool) (*types.Transaction, error) { |