handle success return value separately

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-07-03 15:27:19 -04:00 committed by Jakub
parent 9d236b298a
commit 51c30bfa51
1 changed files with 8 additions and 2 deletions

View File

@ -25,18 +25,24 @@ func (s *StateController) Fetch() {
// For removing a selected peer from connected to status-go
func (s *StateController) TrustPeer(peer *Peer) error {
success, err := s.Client.trustPeer(peer.Enode)
if err != nil || success != true {
if err != nil {
log.Panicln(err)
}
if success != true {
log.Panicln("failed to trust whisper peer")
}
return nil
}
// For removing a selected peer from connected to status-go
func (s *StateController) RemovePeer(peer *Peer) error {
success, err := s.Client.removePeer(peer.Enode)
if err != nil || success != true {
if err != nil {
log.Panicln(err)
}
if success != true {
log.Panicln("failed to remove peer")
}
s.Fetch()
return nil
}