Skip to content

Commit

Permalink
Merge pull request #56 from mysteriumnetwork/pass-register-identity-n…
Browse files Browse the repository at this point in the history
…once

Allow to pass nonce for registration
  • Loading branch information
vkuznecovas authored Apr 29, 2020
2 parents b04a3b1 + d43e819 commit ac10c3c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ type RegistrationRequest struct {
Beneficiary common.Address
Signature []byte
RegistryAddress common.Address
Nonce *big.Int
}

// WriteRequest contains the required params for a write request
Expand Down Expand Up @@ -322,17 +323,21 @@ func (bc *Blockchain) RegisterIdentity(rr RegistrationRequest) (*types.Transacti
ctx, cancel := context.WithTimeout(parent, bc.bcTimeout)
defer cancel()

nonce, err := bc.getNonce(rr.Identity)
if err != nil {
return nil, errors.Wrap(err, "could not get nonce")
nonce := rr.Nonce
if nonce == nil {
nonceUint, err := bc.getNonce(rr.Identity)
if err != nil {
return nil, errors.Wrap(err, "could not get nonce")
}
nonce = big.NewInt(0).SetUint64(nonceUint)
}
tx, err := transactor.RegisterIdentity(&bind.TransactOpts{
From: rr.Identity,
Signer: rr.Signer,
Context: ctx,
GasLimit: rr.GasLimit,
GasPrice: rr.GasPrice,
Nonce: big.NewInt(0).SetUint64(nonce),
Nonce: nonce,
},
rr.AccountantID,
rr.Loan,
Expand Down

0 comments on commit ac10c3c

Please sign in to comment.