mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-06 09:42:19 +00:00
Sharding: Add check if already deposited
Former-commit-id: 32d3ec5c6bcbeb8e77aa7873e395e2b2cd362571 [formerly 623faf56f979a6e3f7bf4f903aac5c967da40dd2] Former-commit-id: 5a60c62411845f441bca4f0a5540cf79ad9e0658
This commit is contained in:
parent
4bfb23a5e7
commit
6de61b5d43
@ -140,6 +140,10 @@ func joinNotaryPool(c client.Client) error {
|
|||||||
return errors.New("joinNotaryPool called when deposit flag was not set")
|
return errors.New("joinNotaryPool called when deposit flag was not set")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if b, err := isAccountInNotaryPool(c); b || err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
log.Info("Joining notary pool")
|
log.Info("Joining notary pool")
|
||||||
txOps, err := c.CreateTXOpts(sharding.NotaryDeposit)
|
txOps, err := c.CreateTXOpts(sharding.NotaryDeposit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -138,4 +138,20 @@ func TestJoinNotaryPool(t *testing.T) {
|
|||||||
if big.NewInt(1).Cmp(numNotaries) != 0 {
|
if big.NewInt(1).Cmp(numNotaries) != 0 {
|
||||||
t.Fatalf("Unexpected number of notaries. Got %d, wanted 1.", numNotaries)
|
t.Fatalf("Unexpected number of notaries. Got %d, wanted 1.", numNotaries)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Trying to join while deposited should do nothing
|
||||||
|
err = joinNotaryPool(client)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
backend.Commit()
|
||||||
|
|
||||||
|
numNotaries, err = smc.NotaryPoolLength(&bind.CallOpts{})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if big.NewInt(1).Cmp(numNotaries) != 0 {
|
||||||
|
t.Fatalf("Unexpected number of notaries. Got %d, wanted 1.", numNotaries)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user