-
Notifications
You must be signed in to change notification settings - Fork 103
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
core: Ensure login in core.resendPendingRequests
#2633
Conversation
Signed-off-by: Philemon Ukane <[email protected]>
client/core/core.go
Outdated
c.notify(newLoginNote("Resuming active trades...")) | ||
c.resolveActiveTrades(crypter) | ||
c.notify(newLoginNote("Connecting to DEX servers...")) | ||
c.initializeDEXConnections(crypter) | ||
c.notify(newLoginNote("Resuming active trades...")) | ||
c.resolveActiveTrades(crypter) |
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.
Seems dangerous. What if the DEX server sends info about an active trade that we haven't loaded from the database yet?
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.
Hmm, then a better resolution to this would be to check if we are logged in? #2617 (comment), but we can just log a msg and not exit.
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.
Yeah maybe.
Signed-off-by: Philemon Ukane <[email protected]>
core.resendPendingRequests
Signed-off-by: Philemon Ukane <[email protected]>
client/core/trade.go
Outdated
@@ -2086,7 +2086,7 @@ func (c *Core) tick(t *trackedTrade) (assetMap, error) { | |||
// This method modifies match fields and MUST be called with the trackedTrade | |||
// mutex lock held for reads. | |||
func (c *Core) resendPendingRequests(t *trackedTrade) { | |||
if t.isSelfGoverned() { | |||
if t.isSelfGoverned() || !c.loggedIn /* we can't send `init` or `redeem` if we are not logged in */ { |
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.
No need to log a message, just move on. It's not going to be helpful to the user and we know this can
happen.
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.
log debug maybe?
Also I think c.loginMtx
should be held.
Signed-off-by: Philemon Ukane <[email protected]>
This PR handles an edge case that causes a match init request to be sent before connecting to the server : See: #2617 (comment)
Closes: #2617