Skip to content

Commit

Permalink
Don't use the sync beforehand - the manager.Make takes care of that
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Apr 22, 2024
1 parent fa266d7 commit c1fc3e1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
5 changes: 0 additions & 5 deletions core/txn/pool/controller/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ func (a *addAction) Execute(ctx node.Context) error {

manager := getManager(signer, a.client)

err = manager.Sync()
if err != nil {
return xerrors.Errorf("failed to sync manager: %v", err)
}

tx, err := manager.Make(args...)
if err != nil {
return xerrors.Errorf("creating transaction: %v", err)
Expand Down
9 changes: 1 addition & 8 deletions core/txn/pool/controller/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,12 @@ func TestExecute(t *testing.T) {
err = action.Execute(ctx)
require.EqualError(t, err, "failed to include tx: "+fake.Err("failed to add"))

getManager = func(c crypto.Signer, s signed.Client) txn.Manager {
return badManager{}
}

err = action.Execute(ctx)
require.EqualError(t, err, "creating transaction: "+fake.Err("make fail"))

getManager = func(c crypto.Signer, s signed.Client) txn.Manager {
return badManager{failSync: true}
}

err = action.Execute(ctx)
require.EqualError(t, err, "failed to sync manager: "+fake.Err("sync fail"))
require.EqualError(t, err, "creating transaction: "+fake.Err("make fail"))

err = os.WriteFile(keyFile, []byte("bad signer"), os.ModePerm)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion core/txn/pool/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (miniController) OnStop(inj node.Injector) error {
return nil
}

// client return monotically increasing nonce
// client returns monotonically increasing nonce
//
// - implements signed.Client
type client struct {
Expand Down

0 comments on commit c1fc3e1

Please sign in to comment.