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) {
|
if ($bitcoin->can_connect() !== true) {
|
||||||
$error[] = "Unable to connect to coin daemon using provided credentials";
|
$error[] = "Unable to connect to coin daemon using provided credentials";
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
else {
|
||||||
}
|
// validate that the wallet service is not in test mode
|
||||||
// if coldwallet is not empty, check if the address is valid -> error
|
if ($bitcoin->is_testnet() == true) {
|
||||||
if (!empty($config['coldwallet']['address'])) {
|
$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.";
|
||||||
try {
|
}
|
||||||
if ($bitcoin->can_connect() == true) {
|
|
||||||
|
// if coldwallet is not empty, check if the address is valid -> error
|
||||||
|
if (!empty($config['coldwallet']['address'])) {
|
||||||
if (!$bitcoin->validateaddress($config['coldwallet']['address']))
|
if (!$bitcoin->validateaddress($config['coldwallet']['address']))
|
||||||
$error[] = "Your cold wallet address is <u>SET and INVALID</u>";
|
$error[] = "Your cold wallet address is <u>SET and INVALID</u>";
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
// if database connection fails -> error
|
// if database connection fails -> error
|
||||||
$db_connect = new mysqli($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']);
|
$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;
|
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