From 182762af5ad89cf6dc94120ac76dac7ecff4bb79 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 2 Apr 2024 18:56:43 +0300 Subject: [PATCH] rpcclient: make default Notary actor options customizable This commit allows to override only MainModifier omitting overriding MainCheckerModifier. Signed-off-by: Anna Shaleva --- pkg/rpcclient/notary/actor.go | 10 +++++----- pkg/rpcclient/notary/doc_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/rpcclient/notary/actor.go b/pkg/rpcclient/notary/actor.go index 925ef9417..94cbaae8b 100644 --- a/pkg/rpcclient/notary/actor.go +++ b/pkg/rpcclient/notary/actor.go @@ -88,8 +88,8 @@ type RPCActor interface { // NewDefaultActorOptions returns the default Actor options. Internal functions // of it need some data from the contract, so it should be added. -func NewDefaultActorOptions(reader *ContractReader, acc *wallet.Account) ActorOptions { - opts := ActorOptions{ +func NewDefaultActorOptions(reader *ContractReader, acc *wallet.Account) *ActorOptions { + opts := &ActorOptions{ FbScript: []byte{byte(opcode.RET)}, FbSigner: actor.SignerAccount{ Signer: transaction.Signer{ @@ -132,8 +132,8 @@ func NewActor(c RPCActor, signers []actor.SignerAccount, simpleAcc *wallet.Accou // NewTunedActor is the same as NewActor, but allows to override the default // options (see ActorOptions for details). Use with care. -func NewTunedActor(c RPCActor, signers []actor.SignerAccount, opts ActorOptions) (*Actor, error) { - return newTunedActor(c, signers, opts.FbSigner.Account, &opts) +func NewTunedActor(c RPCActor, signers []actor.SignerAccount, opts *ActorOptions) (*Actor, error) { + return newTunedActor(c, signers, opts.FbSigner.Account, opts) } func newTunedActor(c RPCActor, signers []actor.SignerAccount, simpleAcc *wallet.Account, opts *ActorOptions) (*Actor, error) { @@ -174,7 +174,7 @@ func newTunedActor(c RPCActor, signers []actor.SignerAccount, simpleAcc *wallet. reader := NewReader(invoker.New(c, nil)) if opts == nil { defOpts := NewDefaultActorOptions(reader, simpleAcc) - opts = &defOpts + opts = defOpts } var notarySA = actor.SignerAccount{ Signer: transaction.Signer{ diff --git a/pkg/rpcclient/notary/doc_test.go b/pkg/rpcclient/notary/doc_test.go index fa6f6909a..7cdb98d6c 100644 --- a/pkg/rpcclient/notary/doc_test.go +++ b/pkg/rpcclient/notary/doc_test.go @@ -54,7 +54,7 @@ func ExampleActor() { panic("deposit failed") } - var opts notary.ActorOptions + var opts = new(notary.ActorOptions) // Add high priority attribute, we gonna be making committee-signed transactions anyway. opts.MainAttributes = []transaction.Attribute{{Type: transaction.HighPriority}}