Merge pull request #31 from pxgamer/feature/blacklist-addresses

Add support for blacklisting addresses
This commit is contained in:
arionum
2018-09-14 22:16:33 +03:00
committed by GitHub
2 changed files with 21 additions and 1 deletions

View File

@@ -17,6 +17,15 @@ final class Blacklist
// phpcs:enable // 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 * Check if a public key is blacklisted
* *
@@ -27,4 +36,15 @@ final class Blacklist
{ {
return key_exists($publicKey, static::PUBLIC_KEYS); 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);
}
} }

View File

@@ -227,7 +227,7 @@ class Transaction
} }
if ($_config['use_official_blacklist']!==false) { if ($_config['use_official_blacklist']!==false) {
if (Blacklist::checkPublicKey($x['public_key'])) { if (Blacklist::checkPublicKey($x['public_key']) || Blacklist::checkAddress($x['src'])) {
return true; return true;
} }
} }