Skip to content
Snippets Groups Projects
Unverified Commit 7fd3e32d authored by Angelo Capossele's avatar Angelo Capossele Committed by GitHub
Browse files

add powInfo (#893)

parent 1cc49378
Branches
No related tags found
No related merge requests found
......@@ -144,6 +144,20 @@ func sendToRemoteLog(networkDelayObject *Object, receiveTime int64) {
_ = remoteLogger.Send(m)
}
func sendPoWInfo(object *Object, powDelta time.Duration) {
m := networkDelay{
NodeID: myID,
ID: object.id.String(),
SentTime: 0,
ReceiveTime: 0,
Delta: powDelta.Nanoseconds(),
Clock: clockEnabled,
Sync: syncbeaconfollower.Synced(),
Type: remoteLogType,
}
_ = remoteLogger.Send(m)
}
type networkDelay struct {
NodeID string `json:"nodeId"`
ID string `json:"id"`
......
......@@ -27,10 +27,17 @@ func broadcastNetworkDelayObject(c echo.Context) error {
now := clock.SyncedTime().UnixNano()
msg, err := issuer.IssuePayload(NewObject(id, now))
obj := NewObject(id, now)
nowWithoutClock := time.Now()
msg, err := issuer.IssuePayload(obj)
if err != nil {
return c.JSON(http.StatusBadRequest, Response{Error: err.Error()})
}
sendPoWInfo(obj, time.Since(nowWithoutClock))
return c.JSON(http.StatusOK, Response{ID: msg.ID().String()})
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment