mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-09 19:21:19 +00:00
rename to collator.go and implement the watchShards func
Former-commit-id: a408cce4805fab38dd0d52d8743c4d00b82133ee [formerly 01b8b29da9443a10ba632f386385e4bc9fc86a84] Former-commit-id: a88f703397c4f0a90414b1769a499bd108dcff05
This commit is contained in:
parent
5ce2be8aeb
commit
319ba38250
@ -27,6 +27,15 @@ func subscribeBlockHeaders(c *Client) error {
|
|||||||
case head := <-headerChan:
|
case head := <-headerChan:
|
||||||
// Query the current state to see if we are an eligible proposer
|
// Query the current state to see if we are an eligible proposer
|
||||||
log.Info(fmt.Sprintf("received new header %v", head.Number.String()))
|
log.Info(fmt.Sprintf("received new header %v", head.Number.String()))
|
||||||
|
// TODO: Only run this code on certain periods?
|
||||||
|
watchShards(head)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// watchShards checks if we are an eligible proposer for collation for
|
||||||
|
// the available shards in the VMC. The function calls getEligibleProposer from
|
||||||
|
// the VMC and proposes a collation if conditions are met
|
||||||
|
func watchShards(head types.Header) {
|
||||||
|
|
||||||
|
}
|
@ -71,9 +71,10 @@ func initVMC(c *Client) error {
|
|||||||
// the account is not in the set, it will deposit 100ETH into contract.
|
// the account is not in the set, it will deposit 100ETH into contract.
|
||||||
func initVMCValidator(c *Client) error {
|
func initVMCValidator(c *Client) error {
|
||||||
|
|
||||||
// TODO: Check if account is already in validator set. Do we need to implement
|
// TODO: Check if account is already in validator set. Fetch this From
|
||||||
// a func in solidity to do this?
|
// the VMC contract's validator set.
|
||||||
|
|
||||||
|
// Unlocks the current account from the keystore
|
||||||
accounts := c.keystore.Accounts()
|
accounts := c.keystore.Accounts()
|
||||||
if len(accounts) == 0 {
|
if len(accounts) == 0 {
|
||||||
return fmt.Errorf("no accounts found")
|
return fmt.Errorf("no accounts found")
|
||||||
@ -96,10 +97,11 @@ func initVMCValidator(c *Client) error {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
tx, err := c.vmc.VMCTransactor.Deposit(&ops, /* validatorcodeaddr */, accounts[0].Address)
|
_, err := c.vmc.VMCTransactor.Deposit(&ops, accounts[0].Address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to deposit eth and become a validator: %v", err)
|
return fmt.Errorf("unable to deposit eth and become a validator: %v", err)
|
||||||
}
|
}
|
||||||
|
log.Info(fmt.Sprintf("deposited 100ETH into contract"))
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user