Merge pull request #31 from pxgamer/feature/blacklist-addresses
Add support for blacklisting addresses
This commit is contained in:
@@ -17,6 +17,15 @@ final class Blacklist
|
||||
// phpcs:enable
|
||||
];
|
||||
|
||||
/**
|
||||
* The official list of blacklisted addresses
|
||||
*/
|
||||
public const ADDRESSES = [
|
||||
// phpcs:disable Generic.Files.LineLength
|
||||
'xuzyMbEGA1tmx1o7mcxSXf2nXuuV1GtKbA4sAqjcNq2gh3shuhwBT5nJHez9AynCaxpJwL6dpkavmZBA3JkrMkg' => 'Octaex Exchange',
|
||||
// phpcs:enable
|
||||
];
|
||||
|
||||
/**
|
||||
* Check if a public key is blacklisted
|
||||
*
|
||||
@@ -27,4 +36,15 @@ final class Blacklist
|
||||
{
|
||||
return key_exists($publicKey, static::PUBLIC_KEYS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an address is blacklisted
|
||||
*
|
||||
* @param string $address
|
||||
* @return bool
|
||||
*/
|
||||
public static function checkAddress(string $address): bool
|
||||
{
|
||||
return key_exists($address, static::ADDRESSES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ class Transaction
|
||||
}
|
||||
|
||||
if ($_config['use_official_blacklist']!==false) {
|
||||
if (Blacklist::checkPublicKey($x['public_key'])) {
|
||||
if (Blacklist::checkPublicKey($x['public_key']) || Blacklist::checkAddress($x['src'])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user