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.
61 lines
1.5 KiB
61 lines
1.5 KiB
4 years ago
|
package rpc
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
4 years ago
|
|
||
4 years ago
|
"github.com/ethereum/go-ethereum/rpc"
|
||
|
"github.com/harmony-one/harmony/hmy"
|
||
|
)
|
||
|
|
||
|
// PrivateDebugService Internal JSON RPC for debugging purpose
|
||
|
type PrivateDebugService struct {
|
||
|
hmy *hmy.Harmony
|
||
|
version Version
|
||
|
}
|
||
|
|
||
|
// NewPrivateDebugAPI creates a new API for the RPC interface
|
||
|
// TODO(dm): expose public via config
|
||
|
func NewPrivateDebugAPI(hmy *hmy.Harmony, version Version) rpc.API {
|
||
|
return rpc.API{
|
||
|
Namespace: version.Namespace(),
|
||
|
Version: APIVersion,
|
||
|
Service: &PrivateDebugService{hmy, version},
|
||
|
Public: false,
|
||
|
}
|
||
|
}
|
||
|
|
||
4 years ago
|
// ConsensusViewChangingID return the current view changing ID to RPC
|
||
4 years ago
|
func (s *PrivateDebugService) ConsensusViewChangingID(
|
||
4 years ago
|
ctx context.Context,
|
||
|
) uint64 {
|
||
4 years ago
|
return s.hmy.NodeAPI.GetConsensusViewChangingID()
|
||
4 years ago
|
}
|
||
|
|
||
4 years ago
|
// ConsensusCurViewID return the current view ID to RPC
|
||
4 years ago
|
func (s *PrivateDebugService) ConsensusCurViewID(
|
||
|
ctx context.Context,
|
||
|
) uint64 {
|
||
|
return s.hmy.NodeAPI.GetConsensusCurViewID()
|
||
|
}
|
||
|
|
||
|
// GetConsensusMode return the current consensus mode
|
||
|
func (s *PrivateDebugService) GetConsensusMode(
|
||
|
ctx context.Context,
|
||
|
) string {
|
||
|
return s.hmy.NodeAPI.GetConsensusMode()
|
||
|
}
|
||
|
|
||
|
// GetConsensusPhase return the current consensus mode
|
||
|
func (s *PrivateDebugService) GetConsensusPhase(
|
||
|
ctx context.Context,
|
||
|
) string {
|
||
|
return s.hmy.NodeAPI.GetConsensusPhase()
|
||
|
}
|
||
4 years ago
|
|
||
|
// GetConfig get harmony config
|
||
|
func (s *PrivateDebugService) GetConfig(
|
||
|
ctx context.Context,
|
||
4 years ago
|
) (StructuredResponse, error) {
|
||
|
return NewStructuredResponse(s.hmy.NodeAPI.GetConfig())
|
||
4 years ago
|
}
|