containsParameter('peer')) { throw new MissingRpcArgumentException('peer'); } try { $address = PeerAddress::fromAddress($rpcRequest->getParameter('peer')); } catch(InvalidArgumentException $e) { throw new InvalidRpcArgumentException('peer', $e->getMessage()); } try { // Check if the contact already exists $peer = $request->getPeer(); if(!ContactManager::isContact($peer, $address)) { return $rpcRequest->produceResponse(false); } // Create the contact ContactManager::deleteContact($peer, $address); } catch (DatabaseOperationException $e) { throw new StandardException('Failed to remove contact', StandardError::INTERNAL_SERVER_ERROR, $e); } // Return success return $rpcRequest->produceResponse(true); } }