Compare commits

...

2 Commits

  1. 17
      common/common.go
  2. 2
      frontend/service.go

17
common/common.go

@ -283,21 +283,30 @@ func CallRpcWithRetries(method string, params []json.RawMessage) (json.RawMessag
result, err := RawRequest(method, params)
if err == nil {
if retryCount > 0 {
Log.Warn(fmt.Sprintf("%s RPC successful"), method)
Log.Warn(fmt.Sprintf("%s RPC successful", method))
}
return result, err
break
}
retryCount++
if retryCount > maxRetries {
if retryCount > maxRetries && method != "sendrawtransaction" {
Log.WithFields(logrus.Fields{
"timeouts": retryCount,
}).Fatal(fmt.Sprintf("unable to issue %s RPC call to hushd node"), method)
}).Fatal(fmt.Sprintf("unable to issue %s RPC call to hushd node", method))
}
if retryCount > maxRetries && method == "sendrawtransaction" {
// TODO: it would be better to only give up if the error is an expired tx
Log.WithFields(logrus.Fields{
"error": err.Error(),
"retry": retryCount,
}).Warn(fmt.Sprintf("giving up on %s rpc", method))
// TODO: return a better error
return nil, nil
}
Log.WithFields(logrus.Fields{
"error": err.Error(),
"retry": retryCount,
}).Warn(fmt.Sprintf("error with %s rpc, retrying..."), method)
}).Warn(fmt.Sprintf("error with %s rpc, retrying...", method))
Time.Sleep(time.Duration(10+retryCount*5) * time.Second) // backoff
}
return nil, nil

2
frontend/service.go

@ -258,7 +258,7 @@ func (s *lwdStreamer) GetCoinsupply(ctx context.Context, in *walletrpc.Empty) (*
}, nil
}
// SendTransaction forwards raw transaction bytes to a zcashd instance over JSON-RPC
// SendTransaction forwards raw transaction bytes to a full node over JSON-RPC
func (s *lwdStreamer) SendTransaction(ctx context.Context, rawtx *walletrpc.RawTransaction) (*walletrpc.SendResponse, error) {
// sendrawtransaction "hexstring" ( allowhighfees )
//

Loading…
Cancel
Save