I've found a good API I want to use to see if my geth is in sync: admin.chainSyncStatus.
However, when I call it through web3/nodejs, I get this error:
/home/myuser/Documents/Code/Crypto/ethRaceWithdrawer/approver_test.js:14
var syncStatus = web3.admin.chainSyncStatus;
^
TypeError: Cannot read property 'chainSyncStatus' of undefined
at Object.<anonymous> (/home/myuser/Documents/Code/Crypto/ethRaceWithdrawer/approver_test.js:14:28)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
What's wrong? I'm including the admin API when calling geth, this way:
geth --rpc --rpcapi eth,web3,personal,admin.
Tried also with web3_extended because it adds the admin APIs, but I got a different error:
/home/myuser/Documents/Code/Crypto/ethPlayground/node_modules/web3/lib/web3/requestmanager.js:61
throw errors.InvalidResponse(result);
^
Error: The method admin_chainSyncStatus does not exist/is not available
at Object.module.exports.InvalidResponse (/home/myuser/Documents/Code/Crypto/ethPlayground/node_modules/web3/lib/web3/errors.js:35:16)
at RequestManager.send (/home/myuser/Documents/Code/Crypto/ethPlayground/node_modules/web3/lib/web3/requestmanager.js:61:22)
at Object.send [as chainSyncStatus] (/home/myuser/Documents/Code/Crypto/ethPlayground/node_modules/web3/lib/web3/method.js:145:58)
at Object.<anonymous> (/home/myuser/Documents/Code/Crypto/ethPlayground/approver_test.js:27:29)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
eth.syncing. – eth May 24 '16 at 09:35