Commit 4f7fc7b2 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke

rpc, xeth: fixed returned tx hash & receipt logs

parent 457a3c8f
...@@ -404,14 +404,14 @@ func NewUncleRes(h *types.Header) *UncleRes { ...@@ -404,14 +404,14 @@ func NewUncleRes(h *types.Header) *UncleRes {
// } // }
type ReceiptRes struct { type ReceiptRes struct {
TransactionHash *hexdata `json:transactionHash` TransactionHash *hexdata `json:"transactionHash"`
TransactionIndex *hexnum `json:transactionIndex` TransactionIndex *hexnum `json:"transactionIndex"`
BlockNumber *hexnum `json:blockNumber` BlockNumber *hexnum `json:"blockNumber"`
BlockHash *hexdata `json:blockHash` BlockHash *hexdata `json:"blockHash"`
CumulativeGasUsed *hexnum `json:cumulativeGasUsed` CumulativeGasUsed *hexnum `json:"cumulativeGasUsed"`
GasUsed *hexnum `json:gasUsed` GasUsed *hexnum `json:"gasUsed"`
ContractAddress *hexdata `json:contractAddress` ContractAddress *hexdata `json:"contractAddress"`
Logs *[]interface{} `json:logs` Logs *[]interface{} `json:"logs"`
} }
func NewReceiptRes(rec *types.Receipt) *ReceiptRes { func NewReceiptRes(rec *types.Receipt) *ReceiptRes {
...@@ -430,7 +430,12 @@ 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 { if bytes.Compare(rec.ContractAddress.Bytes(), bytes.Repeat([]byte{0}, 20)) != 0 {
v.ContractAddress = newHexData(rec.ContractAddress) 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 return v
} }
......
...@@ -973,7 +973,7 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS ...@@ -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()) 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) { func (self *XEth) sign(tx *types.Transaction, from common.Address, didUnlock bool) (*types.Transaction, error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment