GetProgress
- uses the same routine as the log reporter in bitcoin - essentially divides the chainParams checkpoints by the current tip
This commit is contained in:
parent
1027a77d6f
commit
f2c6d310ae
@ -216,6 +216,18 @@ NAN_METHOD(VerifyScript) {
|
|||||||
static bool
|
static bool
|
||||||
set_cooked(void);
|
set_cooked(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetProgress()
|
||||||
|
* bitcoind.getProgress()
|
||||||
|
* provides a float value >= indicating the progress of the blockchain sync
|
||||||
|
*/
|
||||||
|
NAN_METHOD(GetProgress) {
|
||||||
|
const CChainParams& chainParams = Params();
|
||||||
|
float progress = 0;
|
||||||
|
progress = Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), chainActive.Tip());
|
||||||
|
NanReturnValue(progress);
|
||||||
|
};
|
||||||
|
|
||||||
NAN_METHOD(StartTxMon) {
|
NAN_METHOD(StartTxMon) {
|
||||||
Isolate* isolate = Isolate::GetCurrent();
|
Isolate* isolate = Isolate::GetCurrent();
|
||||||
HandleScope scope(isolate);
|
HandleScope scope(isolate);
|
||||||
@ -1670,6 +1682,7 @@ init(Handle<Object> target) {
|
|||||||
NODE_SET_METHOD(target, "sendTransaction", SendTransaction);
|
NODE_SET_METHOD(target, "sendTransaction", SendTransaction);
|
||||||
NODE_SET_METHOD(target, "estimateFee", EstimateFee);
|
NODE_SET_METHOD(target, "estimateFee", EstimateFee);
|
||||||
NODE_SET_METHOD(target, "startTxMon", StartTxMon);
|
NODE_SET_METHOD(target, "startTxMon", StartTxMon);
|
||||||
|
NODE_SET_METHOD(target, "getProgress", GetProgress);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,3 +31,4 @@ NAN_METHOD(VerifyScript);
|
|||||||
NAN_METHOD(SendTransaction);
|
NAN_METHOD(SendTransaction);
|
||||||
NAN_METHOD(EstimateFee);
|
NAN_METHOD(EstimateFee);
|
||||||
NAN_METHOD(StartTxMon);
|
NAN_METHOD(StartTxMon);
|
||||||
|
NAN_METHOD(GetProgress);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user