-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
remove dependency of postgres trigger for broadcaster #11109
remove dependency of postgres trigger for broadcaster #11109
Conversation
I see that you haven't updated any README files. Would it make sense to do so? |
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.
It's awesome this PR cleans up so much code!
I'm not sure exactly what's going on with the switch from pkg/errors.wrap to fmt.Errorf. I assume it's related to the overall change in error changing cause by the removal of the trigger dependency, but I don't entirely understand it.
@@ -223,8 +222,10 @@ func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) Reset(addr | |||
func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) abandon(addr ADDR) (err error) { | |||
ctx, cancel := utils.StopChan(b.chStop).NewCtx() | |||
defer cancel() | |||
err = b.txStore.Abandon(ctx, b.chainID, addr) | |||
return pkgerrors.Wrapf(err, "abandon failed to update txes for key %s", addr.String()) | |||
if err = b.txStore.Abandon(ctx, b.chainID, addr); err != nil { |
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.
is it a common go pattern to do the assignment and comparison this way?
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 typically am a fan of doing it this way to prevent accidental overshadowing of the error... i have witnessed bugs in the past where the error does not get fully handled and gets overwritten accidentally. scoping it this way reduces the chances of that happening slightly
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 now!
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 is so awesome!
} | ||
|
||
// Trigger the Broadcaster to check for new transaction | ||
b.broadcaster.Trigger(txRequest.FromAddress) |
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.
love to see how simple this now is!
Notes: