internal.ethapi.api: Only send callback if set

This commit is contained in:
Patrick Mylund Nielsen 2016-12-19 22:45:55 -05:00
parent 0c05f9fde1
commit d400d62448
1 changed files with 6 additions and 4 deletions

View File

@ -332,10 +332,12 @@ func (a *Async) send(ctx context.Context, s *PublicTransactionPoolAPI, asyncArgs
glog.V(logger.Info).Infof("Error encoding callback JSON: %v", err)
return
}
_, err = http.Post(asyncArgs.CallbackUrl, "application/json", buf)
if err != nil {
glog.V(logger.Info).Infof("Error sending callback: %v", err)
return
if asyncArgs.CallbackUrl != "" {
_, err = http.Post(asyncArgs.CallbackUrl, "application/json", buf)
if err != nil {
glog.V(logger.Info).Infof("Error sending callback: %v", err)
return
}
}
}()
args, err := prepareSendTxArgs(ctx, asyncArgs.SendTxArgs, s.b)