Skip to content

Commit

Permalink
quaistats: Reworked the stats package in the client to send new stats
Browse files Browse the repository at this point in the history
  • Loading branch information
robschleusner authored and gameofpointers committed Nov 7, 2023
1 parent 8294c05 commit 866038c
Show file tree
Hide file tree
Showing 7 changed files with 897 additions and 815 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ endif
ifeq ($(QUAI_STATS),true)
BASE_CMD += --quaistats ${STATS_NAME}:${STATS_PASS}@${STATS_HOST}
endif
ifeq ($(TRUSTED_NODE),true)
BASE_CMD += --trustednode
endif

ifeq ($(SHOW_COLORS),true)
BASE_CMD += --showcolors
Expand Down
3 changes: 2 additions & 1 deletion cmd/go-quai/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, quaiConfig) {
func makeFullNode(ctx *cli.Context) (*node.Node, quaiapi.Backend) {
stack, cfg := makeConfigNode(ctx)
backend, _ := utils.RegisterEthService(stack, &cfg.Eth)
trusted := ctx.Bool(utils.TrustedNodeFlag.Name)

// Add the Quai Stats daemon if requested.
if cfg.Ethstats.URL != "" {
utils.RegisterQuaiStatsService(stack, backend, cfg.Ethstats.URL)
utils.RegisterQuaiStatsService(stack, backend, cfg.Ethstats.URL, trusted)
}
return stack, backend
}
Expand Down
1 change: 1 addition & 0 deletions cmd/go-quai/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ var (
utils.OrchardFlag,
utils.PasswordFileFlag,
utils.QuaiStatsURLFlag,
utils.TrustedNodeFlag,
utils.RegionFlag,
utils.ShowColorsFlag,
utils.SlicesRunningFlag,
Expand Down
1 change: 1 addition & 0 deletions cmd/go-quai/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.GCModeFlag,
utils.TxLookupLimitFlag,
utils.QuaiStatsURLFlag,
utils.TrustedNodeFlag,
utils.IdentityFlag,
utils.LightKDFFlag,
utils.WhitelistFlag,
Expand Down
8 changes: 6 additions & 2 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ var (
Name: "quaistats",
Usage: "Reporting URL of a quaistats service (nodename:secret@host:port)",
}
TrustedNodeFlag = cli.BoolFlag{
Name: "trustednode",
Usage: "Truted node boolean flag for use by team",
}
FakePoWFlag = cli.BoolFlag{
Name: "fakepow",
Usage: "Disables proof-of-work verification",
Expand Down Expand Up @@ -1633,8 +1637,8 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (quaiapi.Backen

// RegisterQuaiStatsService configures the Quai Stats daemon and adds it to
// the given node.
func RegisterQuaiStatsService(stack *node.Node, backend quaiapi.Backend, url string) {
if err := quaistats.New(stack, backend, backend.Engine(), url); err != nil {
func RegisterQuaiStatsService(stack *node.Node, backend quaiapi.Backend, url string, trusted bool) {
if err := quaistats.New(stack, backend, backend.Engine(), url, trusted); err != nil {
Fatalf("Failed to register the Quai Stats service: %v", err)
}
}
Expand Down
3 changes: 1 addition & 2 deletions core/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,8 @@ func (sl *Slice) Append(header *types.Header, domPendingHeader *types.Header, do
return nil, false, false, err
}

time9 = common.PrettyDuration(time.Since(start))

}
time9 = common.PrettyDuration(time.Since(start))
sl.updatePhCache(pendingHeaderWithTermini, true, nil, subReorg, common.NodeLocation)

var updateDom bool
Expand Down
Loading

0 comments on commit 866038c

Please sign in to comment.