Skip to content

Commit

Permalink
simplify account sequence testin lcd and rpc clients
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasMahe committed May 28, 2020
1 parent 4e25a7e commit 3abe409
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions cosmos/lcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,11 @@ func (lcd *LCD) getAccount() (*auth.BaseAccount, error) {
if accR.Address.Empty() {
return nil, fmt.Errorf("account %q doesn't exist", lcd.acc.GetAddress().String())
}
localSeq := lcd.acc.GetSequence()
lcd.acc = accR
// replace seq if sup
if localSeq > lcd.acc.GetSequence() {
lcd.acc.SetSequence(localSeq)
if lcd.acc.GetSequence() > accR.GetSequence() {
accR.SetSequence(lcd.acc.GetSequence())
}
lcd.acc = accR
return lcd.acc, nil
}

Expand Down
7 changes: 3 additions & 4 deletions cosmos/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,11 @@ func (c *RPC) GetAccount() (authExported.Account, error) {
if err != nil {
return nil, err
}
localSeq := c.acc.GetSequence()
c.acc = accR
// replace seq if sup
if localSeq > c.acc.GetSequence() {
c.acc.SetSequence(localSeq)
if c.acc.GetSequence() > accR.GetSequence() {
accR.SetSequence(c.acc.GetSequence())
}
c.acc = accR
return c.acc, nil
}

Expand Down

0 comments on commit 3abe409

Please sign in to comment.