mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
emulate getinfo for wallets who copy bitcoin mistakes (#250)
like vertcoin 0.12... for sure its more efficient sigh
This commit is contained in:
parent
9c438eeb94
commit
2d0a2df480
2 changed files with 32 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -18,3 +18,5 @@ web/serverconfig.php
|
||||||
web/assets/
|
web/assets/
|
||||||
*.rej
|
*.rej
|
||||||
*.orig
|
*.orig
|
||||||
|
.idea/*
|
||||||
|
web/yaamp/.idea/
|
|
@ -7,6 +7,7 @@ class WalletRPC {
|
||||||
public $type = 'Bitcoin';
|
public $type = 'Bitcoin';
|
||||||
protected $rpc;
|
protected $rpc;
|
||||||
protected $rpc_wallet;
|
protected $rpc_wallet;
|
||||||
|
protected $hasGetInfo = false;
|
||||||
|
|
||||||
// cache
|
// cache
|
||||||
protected $account;
|
protected $account;
|
||||||
|
@ -42,6 +43,7 @@ class WalletRPC {
|
||||||
default:
|
default:
|
||||||
$this->type = 'Bitcoin';
|
$this->type = 'Bitcoin';
|
||||||
$this->rpc = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport, $url);
|
$this->rpc = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport, $url);
|
||||||
|
$this->hasGetInfo = $coin->hasgetinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -377,7 +379,34 @@ class WalletRPC {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bitcoin RPC
|
// Bitcoin RPC
|
||||||
$res = $this->rpc->__call($method,$params);
|
switch ($method) {
|
||||||
|
case 'getinfo':
|
||||||
|
if ($this->hasGetInfo) {
|
||||||
|
$res = $this->rpc->__call($method,$params);
|
||||||
|
} else {
|
||||||
|
$miningInfo = $this->rpc->getmininginfo();
|
||||||
|
$res["blocks"] = arraySafeVal($miningInfo,"blocks");
|
||||||
|
$res["difficulty"] = arraySafeVal($miningInfo,"difficulty");
|
||||||
|
$res["testnet"] = "main" != arraySafeVal($miningInfo,"chain");
|
||||||
|
$walletInfo = $this->rpc->getwalletinfo();
|
||||||
|
$res["walletversion"] = arraySafeVal($walletInfo,"walletversion");
|
||||||
|
$res["balance"] = arraySafeVal($walletInfo,"balance");
|
||||||
|
$res["keypoololdest"] = arraySafeVal($walletInfo,"keypoololdest");
|
||||||
|
$res["keypoolsize"] = arraySafeVal($walletInfo,"keypoolsize");
|
||||||
|
$res["paytxfee"] = arraySafeVal($walletInfo,"paytxfee");
|
||||||
|
$networkInfo = $this->rpc->getnetworkinfo();
|
||||||
|
$res["version"] = arraySafeVal($networkInfo,"version");
|
||||||
|
$res["protocolversion"] = arraySafeVal($networkInfo,"protocolversion");
|
||||||
|
$res["timeoffset"] = arraySafeVal($networkInfo,"timeoffset");
|
||||||
|
$res["connections"] = arraySafeVal($networkInfo,"connections");
|
||||||
|
// $res["proxy"] = arraySafeVal($networkInfo,"networks")[0]["proxy"];
|
||||||
|
$res["relayfee"] = arraySafeVal($networkInfo,"relayfee");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$res = $this->rpc->__call($method,$params);
|
||||||
|
}
|
||||||
|
|
||||||
$this->error = $this->rpc->error;
|
$this->error = $this->rpc->error;
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue