File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package validate
33import (
44 "fmt"
55 "net/http"
6+ "slices"
67 "strings"
78 "time"
89)
@@ -49,7 +50,12 @@ func ValidateBeaconNodeAddress(addresses string) error {
4950
5051 defer resp .Body .Close ()
5152
52- if resp .StatusCode != http .StatusOK {
53+ // Acceptable status codes are 200 and 206.
54+ // 200 is the status code for a healthy beacon node.
55+ // 206 is the status code for a beacon node that is syncing.
56+ acceptableStatusCodes := []int {http .StatusOK , http .StatusPartialContent }
57+
58+ if ! slices .Contains (acceptableStatusCodes , resp .StatusCode ) {
5359 lastErr = fmt .Errorf ("beacon node %s returned status %d" , address , resp .StatusCode )
5460
5561 continue
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ func TestValidateBeaconNodeAddress(t *testing.T) {
3333 w .WriteHeader (http .StatusOK )
3434 })),
3535 httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
36- w .WriteHeader (http .StatusOK )
36+ w .WriteHeader (http .StatusPartialContent )
3737 })),
3838 },
3939 wantErr : false ,
You can’t perform that action at this time.
0 commit comments