76: Add indexing of ExecutionPayloads (and other Merge-related updates). #73
@ -16,9 +16,11 @@
|
|||||||
package beaconclient
|
package beaconclient
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -71,14 +73,17 @@ func (bc BeaconClient) QueryHeadSync() (Sync, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
var body bytes.Buffer
|
||||||
|
buf := bufio.NewWriter(&body)
|
||||||
|
_, err = io.Copy(buf, resp.Body)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return syncStatus, err
|
return syncStatus, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(body, &syncStatus); err != nil {
|
if err := json.Unmarshal(body.Bytes(), &syncStatus); err != nil {
|
||||||
loghelper.LogEndpoint(bcSync).WithFields(log.Fields{
|
loghelper.LogEndpoint(bcSync).WithFields(log.Fields{
|
||||||
"rawMessage": string(body),
|
"rawMessage": body.String(),
|
||||||
"err": err,
|
"err": err,
|
||||||
}).Error("Unable to unmarshal sync status")
|
}).Error("Unable to unmarshal sync status")
|
||||||
return syncStatus, err
|
return syncStatus, err
|
||||||
@ -149,14 +154,16 @@ func (bc BeaconClient) queryLighthouseDbInfo() (LighthouseDatabaseInfo, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
var body bytes.Buffer
|
||||||
|
buf := bufio.NewWriter(&body)
|
||||||
|
_, err = io.Copy(buf, resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return dbInfo, err
|
return dbInfo, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(body, &dbInfo); err != nil {
|
if err := json.Unmarshal(body.Bytes(), &dbInfo); err != nil {
|
||||||
loghelper.LogEndpoint(lhDbInfo).WithFields(log.Fields{
|
loghelper.LogEndpoint(lhDbInfo).WithFields(log.Fields{
|
||||||
"rawMessage": string(body),
|
"rawMessage": body.String(),
|
||||||
"err": err,
|
"err": err,
|
||||||
}).Error("Unable to unmarshal the lighthouse database information")
|
}).Error("Unable to unmarshal the lighthouse database information")
|
||||||
return dbInfo, err
|
return dbInfo, err
|
||||||
|
@ -18,8 +18,10 @@
|
|||||||
package beaconclient
|
package beaconclient
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
@ -59,11 +61,13 @@ func querySsz(endpoint string, slot Slot) ([]byte, int, error) {
|
|||||||
return nil, rc, fmt.Errorf("HTTP Error: %d", rc)
|
return nil, rc, fmt.Errorf("HTTP Error: %d", rc)
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(response.Body)
|
var body bytes.Buffer
|
||||||
|
buf := bufio.NewWriter(&body)
|
||||||
|
_, err = io.Copy(buf, response.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
loghelper.LogSlotError(slot.Number(), err).Error("Unable to turn response into a []bytes array!")
|
loghelper.LogSlotError(slot.Number(), err).Error("Unable to turn response into a []bytes array!")
|
||||||
return nil, rc, fmt.Errorf("Unable to turn response into a []bytes array!: %s", err.Error())
|
return nil, rc, fmt.Errorf("Unable to turn response into a []bytes array!: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return body, rc, nil
|
return body.Bytes(), rc, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user