aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/service.go
diff options
context:
space:
mode:
authorAaron Buchwald <aaron.buchwald56@gmail.com>2020-10-30 11:33:41 -0400
committerAaron Buchwald <aaron.buchwald56@gmail.com>2020-10-30 11:33:41 -0400
commit4862c2d3a6c18855fee72137db54ed62a0ce6704 (patch)
tree07e5f447b7bcd818582c7967e98b40d16bec0312 /plugin/evm/service.go
parent4023ae20cb2b7cd228a68670bc55a6c9cdbabc36 (diff)
Add back net API
Diffstat (limited to 'plugin/evm/service.go')
-rw-r--r--plugin/evm/service.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugin/evm/service.go b/plugin/evm/service.go
index f1c30c5..a934941 100644
--- a/plugin/evm/service.go
+++ b/plugin/evm/service.go
@@ -38,6 +38,18 @@ type SnowmanAPI struct{ vm *VM }
// AvaxAPI offers Avalanche network related API methods
type AvaxAPI struct{ vm *VM }
+// NetAPI offers network related API methods
+type NetAPI struct{ vm *VM }
+
+// Listening returns an indication if the node is listening for network connections.
+func (s *NetAPI) Listening() bool { return true } // always listening
+
+// PeerCount returns the number of connected peers
+func (s *NetAPI) PeerCount() hexutil.Uint { return hexutil.Uint(0) } // TODO: report number of connected peers
+
+// Version returns the current ethereum protocol version.
+func (s *NetAPI) Version() string { return fmt.Sprintf("%d", s.vm.networkID) }
+
// GetAcceptedFrontReply defines the reply that will be sent from the
// GetAcceptedFront API call
type GetAcceptedFrontReply struct {