-
Notifications
You must be signed in to change notification settings - Fork 344
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
fix: runtime panic #2836
fix: runtime panic #2836
Conversation
pkg/debugapi/debugapi.go
Outdated
@@ -125,6 +126,9 @@ func (s *Service) Configure(overlay swarm.Address, p2p p2p.DebugService, pingpon | |||
s.chequebook = chequebook | |||
s.swapEnabled = swapEnabled | |||
s.swap = swap | |||
if !chainEnabled { |
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 extra parameter can be avoided by either initialising swap to noOpSwap
before passing here or maybe checking if the swap == nil
.
pkg/debugapi/debugapi.go
Outdated
@@ -145,3 +149,54 @@ func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |||
|
|||
h.ServeHTTP(w, r) | |||
} | |||
|
|||
type noOpSwap struct { |
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.
So I went through the APIs to see how they are handled. Seems like there are a few errors like ErrNoChequebook which are being handled. I wonder if we should retain the errors here instead of returning empty responses? If API expects to send No Chequebook error if there is no chequebook, then this would sort of break that no?
Checklist
Description
Fixes the
/chequebook
runtime panic.This change is