refactor(bank, feegrant, authz): avoid creating baseaccount (#19188)
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
co-authored by
Aleksandr Bezobchuk
parent
26d30f2111
commit
869c96c403
@@ -48,7 +48,7 @@ type TestAccountRetriever struct {
|
||||
func (t TestAccountRetriever) GetAccount(_ Context, addr sdk.AccAddress) (Account, error) {
|
||||
acc, ok := t.Accounts[addr.String()]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("account %s not found", addr)
|
||||
return nil, fmt.Errorf("account: account %s not found", addr)
|
||||
}
|
||||
|
||||
return acc, nil
|
||||
@@ -68,7 +68,7 @@ func (t TestAccountRetriever) GetAccountWithHeight(clientCtx Context, addr sdk.A
|
||||
func (t TestAccountRetriever) EnsureExists(_ Context, addr sdk.AccAddress) error {
|
||||
_, ok := t.Accounts[addr.String()]
|
||||
if !ok {
|
||||
return fmt.Errorf("account %s not found", addr)
|
||||
return fmt.Errorf("ensureExists: account %s not found", addr)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -77,7 +77,7 @@ func (t TestAccountRetriever) EnsureExists(_ Context, addr sdk.AccAddress) error
|
||||
func (t TestAccountRetriever) GetAccountNumberSequence(_ Context, addr sdk.AccAddress) (accNum, accSeq uint64, err error) {
|
||||
acc, ok := t.Accounts[addr.String()]
|
||||
if !ok {
|
||||
return 0, 0, fmt.Errorf("account %s not found", addr)
|
||||
return 0, 0, fmt.Errorf("accountNumberSequence: account %s not found", addr)
|
||||
}
|
||||
return acc.Num, acc.Seq, nil
|
||||
}
|
||||
|
||||
@@ -505,10 +505,6 @@ func (f Factory) Prepare(clientCtx client.Context) (Factory, error) {
|
||||
fc := f
|
||||
from := clientCtx.FromAddress
|
||||
|
||||
if err := fc.accountRetriever.EnsureExists(clientCtx, from); err != nil {
|
||||
return fc, err
|
||||
}
|
||||
|
||||
initNum, initSeq := fc.accountNumber, fc.sequence
|
||||
if initNum == 0 || initSeq == 0 {
|
||||
num, seq, err := fc.accountRetriever.GetAccountNumberSequence(clientCtx, from)
|
||||
|
||||
@@ -29,7 +29,6 @@ func GenerateOrBroadcastTxCLI(clientCtx client.Context, flagSet *pflag.FlagSet,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return GenerateOrBroadcastTxWithFactory(clientCtx, txf, msgs...)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user