Refactor AddressBook methods to streamline peer address handling and improve error management

https://github.com/nosial/Socialbox-PHP/issues/29
This commit is contained in:
netkas 2025-03-11 22:48:38 -04:00
parent 81b3dcf3ea
commit a842818175
Signed by: netkas
GPG key ID: 4D8629441B76E4CC
7 changed files with 23 additions and 58 deletions

View file

@ -29,19 +29,12 @@
throw new MissingRpcArgumentException('peer');
}
try
{
$address = PeerAddress::fromAddress($rpcRequest->getParameter('peer'));
}
catch(InvalidArgumentException $e)
{
throw new InvalidRpcArgumentException('peer', $e);
}
$peerAddress = PeerAddress::fromAddress($rpcRequest->getParameter('peer'));
try
{
$peer = $request->getPeer();
return $rpcRequest->produceResponse(ContactManager::isContact($peer, $address));
return $rpcRequest->produceResponse(ContactManager::isContact($peer, $peerAddress));
}
catch (DatabaseOperationException $e)
{