-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use generic signer interface #46
Conversation
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
Signed-off-by: Daisuke Kanda <[email protected]>
func (s *EthereumSigner) SetLogger(logger *log.RelayLogger) { | ||
s.logger = logger | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After calling SetLogger
and finishing the processing, we need to reset the logger, right?
origLogger := c.ethereumSigner.GetLogger()
c.ethereumSigner.SetLogger(newLogger)
<... some processing ...>
c.ethereumSigner.SetLogger(origLogger)
or
c.ethereumSigner.PushLogger(newLogger)
<... some processing ...>
defer c.ethereumSigner.PopLogger()
In any case, we should define an interface that clearly indicates the section where the configured logger is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This EthereumSigner use logger only in Sign function and no need to have dedicate logger instance(such like use different output log file).
How abount Sign function get logger or ctx which has logger as an arument?
func (s *EthereumSigner) Sign(address common.Address, tx *gethtypes.Transaction, logger *log.RelayLogger) (*gethtypes.Transaction, error) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
fixed by using defer SetLogger(oldlogger)
pattern in tx.go
Signed-off-by: Daisuke Kanda <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you.
Replace ethereum signer with bytes[] signer interface added in hyperledger-labs/yui-relayer#142