You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.8 KiB
74 lines
1.8 KiB
package rpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/woop-chain/woop/eth/rpc"
|
|
"github.com/woop-chain/woop/wiki"
|
|
)
|
|
|
|
// PrivateDebugService Internal JSON RPC for debugging purpose
|
|
type PrivateDebugService struct {
|
|
wiki *wiki.Woop
|
|
version Version
|
|
}
|
|
|
|
// NewPrivateDebugAPI creates a new API for the RPC interface
|
|
// TODO(dm): expose public via config
|
|
func NewPrivateDebugAPI(wiki *wiki.Woop, version Version) rpc.API {
|
|
return rpc.API{
|
|
Namespace: version.Namespace(),
|
|
Version: APIVersion,
|
|
Service: &PrivateDebugService{wiki, version},
|
|
Public: false,
|
|
}
|
|
}
|
|
|
|
// ConsensusViewChangingID return the current view changing ID to RPC
|
|
func (s *PrivateDebugService) ConsensusViewChangingID(
|
|
ctx context.Context,
|
|
) uint64 {
|
|
return s.wiki.NodeAPI.GetConsensusViewChangingID()
|
|
}
|
|
|
|
// ConsensusCurViewID return the current view ID to RPC
|
|
func (s *PrivateDebugService) ConsensusCurViewID(
|
|
ctx context.Context,
|
|
) uint64 {
|
|
return s.wiki.NodeAPI.GetConsensusCurViewID()
|
|
}
|
|
|
|
// GetConsensusMode return the current consensus mode
|
|
func (s *PrivateDebugService) GetConsensusMode(
|
|
ctx context.Context,
|
|
) string {
|
|
return s.wiki.NodeAPI.GetConsensusMode()
|
|
}
|
|
|
|
// GetConsensusPhase return the current consensus mode
|
|
func (s *PrivateDebugService) GetConsensusPhase(
|
|
ctx context.Context,
|
|
) string {
|
|
return s.wiki.NodeAPI.GetConsensusPhase()
|
|
}
|
|
|
|
// GetConfig get woop config
|
|
func (s *PrivateDebugService) GetConfig(
|
|
ctx context.Context,
|
|
) (StructuredResponse, error) {
|
|
return NewStructuredResponse(s.wiki.NodeAPI.GetConfig())
|
|
}
|
|
|
|
// GetLastSigningPower get last signed power
|
|
func (s *PrivateDebugService) GetLastSigningPower(
|
|
ctx context.Context,
|
|
) (float64, error) {
|
|
return s.wiki.NodeAPI.GetLastSigningPower()
|
|
}
|
|
|
|
// GetLastSigningPower2 get last signed power
|
|
func (s *PrivateDebugService) GetLastSigningPower2(
|
|
ctx context.Context,
|
|
) (float64, error) {
|
|
return s.wiki.NodeAPI.GetLastSigningPower2()
|
|
}
|
|
|