Register registers miner address to the contract. It returns false if the miner address couldn't be able to register to the pool even though it didn't register before. It returns true otherwise, in this case, Register does nothing if the address registered before or registers the address if it didn'
(addr common.Address)
| 51 | // It returns true otherwise, in this case, Register does nothing if the |
| 52 | // address registered before or registers the address if it didn't. |
| 53 | func (sp *SmartPool) Register(addr common.Address) bool { |
| 54 | if sp.Contract.IsRegistered() { |
| 55 | smartpool.Output.Printf("The address is already registered to the pool. Good to go.\n") |
| 56 | return true |
| 57 | } |
| 58 | if !sp.Contract.CanRegister() { |
| 59 | smartpool.Output.Printf("Your etherbase address couldn't register to the pool. You need to try another address.\n") |
| 60 | return false |
| 61 | } |
| 62 | smartpool.Output.Printf("Registering to the pool. Please wait...") |
| 63 | err := sp.Contract.Register(addr) |
| 64 | if err != nil { |
| 65 | smartpool.Output.Printf("Unable to register to the pool: %s\n", err) |
| 66 | return false |
| 67 | } |
| 68 | if !sp.Contract.IsRegistered() { |
| 69 | smartpool.Output.Printf("You are not accepted by the pool yet. Please wait about 30s and try again.\n") |
| 70 | return false |
| 71 | } |
| 72 | smartpool.Output.Printf("Done.\n") |
| 73 | return true |
| 74 | } |
| 75 | |
| 76 | // GetWork returns miner work |
| 77 | func (sp *SmartPool) GetWork() smartpool.Work { |
no test coverage detected