Fix handling of result in ethereum SendRawTransaction
This commit is contained in:
parent
ccfc350205
commit
2fd84dd97b
@ -513,17 +513,14 @@ func (b *EthereumRPC) SendRawTransaction(hex string) (string, error) {
|
|||||||
} else if len(raw) == 0 {
|
} else if len(raw) == 0 {
|
||||||
return "", errors.New("SendRawTransaction: failed")
|
return "", errors.New("SendRawTransaction: failed")
|
||||||
}
|
}
|
||||||
type rpcSendResult struct {
|
var result string
|
||||||
Result string `json:"result"`
|
if err := json.Unmarshal(raw, &result); err != nil {
|
||||||
}
|
|
||||||
var r rpcSendResult
|
|
||||||
if err := json.Unmarshal(raw, &r); err != nil {
|
|
||||||
return "", errors.Annotatef(err, "raw result %v", raw)
|
return "", errors.Annotatef(err, "raw result %v", raw)
|
||||||
}
|
}
|
||||||
if r.Result == "" {
|
if result == "" {
|
||||||
return "", errors.New("SendRawTransaction: failed, empty result")
|
return "", errors.New("SendRawTransaction: failed, empty result")
|
||||||
}
|
}
|
||||||
return r.Result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *EthereumRPC) ResyncMempool(onNewTxAddr func(txid string, addr string)) (int, error) {
|
func (b *EthereumRPC) ResyncMempool(onNewTxAddr func(txid string, addr string)) (int, error) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user