Commit 89cb3e3b authored by Felipe Andrade's avatar Felipe Andrade

address rabbits concerns

parent 859e6437
...@@ -65,6 +65,13 @@ func (p *Provider) RoundTrip(ctx context.Context) { ...@@ -65,6 +65,13 @@ func (p *Provider) RoundTrip(ctx context.Context) {
"err", err) "err", err)
return return
} }
if from == nil {
log.Error("from address cannot be nil",
"provider", p.name,
"nonce", nonce,
"err", err)
return
}
nonce = tx.Nonce() nonce = tx.Nonce()
signedTx, err := p.sign(ctx, from, tx) signedTx, err := p.sign(ctx, from, tx)
...@@ -197,7 +204,7 @@ func (p *Provider) createTx(ctx context.Context, client *iclients.InstrumentedEt ...@@ -197,7 +204,7 @@ func (p *Provider) createTx(ctx context.Context, client *iclients.InstrumentedEt
if nonce == 0 { if nonce == 0 {
nonce, err = client.PendingNonceAt(ctx, p.walletConfig.Address) nonce, err = client.PendingNonceAt(ctx, p.walletConfig.Address)
if err != nil { if err != nil {
log.Error("cant get nounce", log.Error("cant get nonce",
"provider", p.name, "provider", p.name,
"nonce", nonce, "nonce", nonce,
"err", err) "err", err)
...@@ -276,6 +283,7 @@ func (p *Provider) sign(ctx context.Context, from *common.Address, tx *types.Tra ...@@ -276,6 +283,7 @@ func (p *Provider) sign(ctx context.Context, from *common.Address, tx *types.Tra
log.Debug("using static signer") log.Debug("using static signer")
privateKey, err := crypto.HexToECDSA(p.walletConfig.PrivateKey) privateKey, err := crypto.HexToECDSA(p.walletConfig.PrivateKey)
if err != nil { if err != nil {
log.Error("failed to parse private key", "err", err)
return nil, err return nil, err
} }
return types.SignTx(tx, types.LatestSignerForChainID(&p.walletConfig.ChainID), privateKey) return types.SignTx(tx, types.LatestSignerForChainID(&p.walletConfig.ChainID), privateKey)
...@@ -286,11 +294,8 @@ func (p *Provider) sign(ctx context.Context, from *common.Address, tx *types.Tra ...@@ -286,11 +294,8 @@ func (p *Provider) sign(ctx context.Context, from *common.Address, tx *types.Tra
TLSKey: p.signerConfig.TLSKey, TLSKey: p.signerConfig.TLSKey,
} }
client, err := iclients.NewSignerClient(p.name, log.Root(), p.signerConfig.URL, tlsConfig) client, err := iclients.NewSignerClient(p.name, log.Root(), p.signerConfig.URL, tlsConfig)
log.Debug("signerclient", if err != nil || client == nil {
"client", client, log.Error("failed to create signer client", "err", err)
"err", err)
if err != nil {
return nil, err
} }
if client == nil { if client == nil {
......
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