parent
47f7ab1525
commit
741735b73e
@ -0,0 +1,19 @@ |
||||
# Nodes running at bootstrap |
||||
|
||||
``` |
||||
We will have N+1 shards running at bootstrap where shard 0 is considered as beacon shard. As the staking will happen in beacon shard the beaconchain block should contain accounts where the new node utilizes to register. We will keep the current node as bootstrap nodes running as beaconchain which provide with followings: |
||||
|
||||
1. Provide the communication protocol with new node. |
||||
2. How staking happens. |
||||
3. Data structure for staking |
||||
4. How to update discovery with DNS Seeder (bootnodes) |
||||
5. |
||||
``` |
||||
|
||||
```mermaid |
||||
graph LR |
||||
A[Hard edge] -->B(Round edge) |
||||
B --> C{Decision} |
||||
C -->|One| D[Result one] |
||||
C -->|Two| E[Result two] |
||||
``` |
@ -0,0 +1,55 @@ |
||||
package service |
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/ethereum/go-ethereum/common" |
||||
clientService "github.com/harmony-one/harmony/api/client/service" |
||||
"github.com/harmony-one/harmony/core/state" |
||||
"github.com/harmony-one/harmony/internal/utils" |
||||
) |
||||
|
||||
const ( |
||||
// ClientServicePortDiff is the positive port diff for client service
|
||||
ClientServicePortDiff = 5555 |
||||
) |
||||
|
||||
// SupportClient ...
|
||||
type SupportClient struct { |
||||
server *clientService.Server |
||||
port string |
||||
} |
||||
|
||||
// NewSupportClient ...
|
||||
func NewSupportClient(stateReader func() (*state.DB, error), callFaucetContract func(common.Address) common.Hash, nodePort string) *SupportClient { |
||||
port, _ := strconv.Atoi(nodePort) |
||||
return &SupportClient{server: clientService.NewServer(stateReader, callFaucetContract), port: strconv.Itoa(port + ClientServicePortDiff)} |
||||
} |
||||
|
||||
// Start ...
|
||||
func (sc *SupportClient) Start() { |
||||
sc.server.Start(sc.ip, sc.port) |
||||
} |
||||
|
||||
// Stop ...
|
||||
func (sc *SupportClient) Stop() { |
||||
|
||||
} |
||||
|
||||
// SupportClient initializes and starts the client service
|
||||
func (node *Node) SupportClient() { |
||||
node.InitClientServer() |
||||
node.StartClientServer() |
||||
} |
||||
|
||||
// InitClientServer initializes client server.
|
||||
func (node *Node) InitClientServer() { |
||||
node.clientServer = clientService.NewServer(node.blockchain.State, node.CallFaucetContract) |
||||
} |
||||
|
||||
// StartClientServer starts client server.
|
||||
func (node *Node) StartClientServer() { |
||||
port, _ := strconv.Atoi(node.SelfPeer.Port) |
||||
utils.GetLogInstance().Info("support_client: StartClientServer on port:", "port", port+ClientServicePortDiff) |
||||
node.clientServer.Start(node.SelfPeer.IP, strconv.Itoa(port+ClientServicePortDiff)) |
||||
} |
Loading…
Reference in new issue