Merge pull request #1726 from j4s0n/fix/next/issue-1725
(#1725) Fix cold wallet check FP and added testnet detection
This commit is contained in:
commit
c622d7c69b
@ -65,17 +65,19 @@ if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA'][
|
||||
if ($bitcoin->can_connect() !== true) {
|
||||
$error[] = "Unable to connect to coin daemon using provided credentials";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
// if coldwallet is not empty, check if the address is valid -> error
|
||||
if (!empty($config['coldwallet']['address'])) {
|
||||
try {
|
||||
if ($bitcoin->can_connect() == true) {
|
||||
else {
|
||||
// validate that the wallet service is not in test mode
|
||||
if ($bitcoin->is_testnet() == true) {
|
||||
$error[] = "The coin daemon service is running as a testnet. Check the TESTNET setting in your coin daemon config and make sure the correct port is set in the MPOS config.";
|
||||
}
|
||||
|
||||
// if coldwallet is not empty, check if the address is valid -> error
|
||||
if (!empty($config['coldwallet']['address'])) {
|
||||
if (!$bitcoin->validateaddress($config['coldwallet']['address']))
|
||||
$error[] = "Your cold wallet address is <u>SET and INVALID</u>";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
// if database connection fails -> error
|
||||
$db_connect = new mysqli($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']);
|
||||
|
||||
@ -308,4 +308,16 @@ class BitcoinClient extends jsonRPCClient {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function is_testnet() {
|
||||
try {
|
||||
$r = parent::getinfo();
|
||||
if ($r['testnet']) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user