forked from TrueCloudLab/neoneo-go
rpcclient: always return tx hash from sendrawtransaction
Let upper-layer APIs like actor.Send() return it as well. Server can return "already exists" which is an error and yet at the same time a very special one, in many cases it means we can proceed with waiting for the TX to settle.
This commit is contained in:
parent
0039615ae3
commit
c95d140113
1 changed files with 4 additions and 5 deletions
|
@ -692,17 +692,16 @@ func (c *Client) invokeSomething(method string, p []interface{}, signers []trans
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
// SendRawTransaction broadcasts a transaction over the NEO network.
|
||||
// The given hex string needs to be signed with a keypair.
|
||||
// When the result of the response object is true, the TX has successfully
|
||||
// been broadcasted to the network.
|
||||
// SendRawTransaction broadcasts the given transaction to the Neo network.
|
||||
// It always returns transaction hash, when successful (no error) this is the
|
||||
// hash returned from server, when not it's a locally calculated rawTX hash.
|
||||
func (c *Client) SendRawTransaction(rawTX *transaction.Transaction) (util.Uint256, error) {
|
||||
var (
|
||||
params = []interface{}{rawTX.Bytes()}
|
||||
resp = new(result.RelayResult)
|
||||
)
|
||||
if err := c.performRequest("sendrawtransaction", params, resp); err != nil {
|
||||
return util.Uint256{}, err
|
||||
return rawTX.Hash(), err
|
||||
}
|
||||
return resp.Hash, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue