Merge pull request #257 from kleetus/feature/remove_getTxOutSetInfo
Feature/remove get tx out set info
This commit is contained in:
commit
68b0120319
|
@ -92,7 +92,6 @@ console.log(spent);
|
|||
|
||||
- `bitcoind.start(callback)` - Start the JavaScript Bitcoin node, the callback is called when the daemon is ready.
|
||||
- `bitcoind.getInfo()` - Basic information about the chain including total number of blocks.
|
||||
- `bitcoind.getTxOutSetInfo()` - Basic information about the chain including total number of blocks.
|
||||
- `bitcoind.isSynced()` - Returns a boolean if the daemon is fully synced (not the initial block download)
|
||||
- `bitcoind.syncPercentage()` - Returns the current estimate of blockchain download as a percentage.
|
||||
- `bitcoind.stop(callback)` - Stop the JavaScript bitcoin node safely, the callback will be called when bitcoind is closed. This will also be done automatically on `process.exit`. It also takes the bitcoind node off the libuv event loop. If the daemon object is the only thing on the event loop. Node will simply close.
|
||||
|
|
|
@ -410,27 +410,6 @@ describe('Daemon Binding Functionality', function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe('get transaction output set information', function() {
|
||||
var bestblock;
|
||||
it('will get the correct info', function() {
|
||||
var info = bitcoind.getTxOutSetInfo();
|
||||
info.bestblock.should.be.a('string');
|
||||
bestblock = info.bestblock;
|
||||
info.bestblock.length.should.equal(64);
|
||||
info.bytes_serialized.should.equal(10431);
|
||||
info.hash_serialized.should.be.a('string');
|
||||
info.hash_serialized.length.should.equal(64);
|
||||
info.height.should.equal(151);
|
||||
info.total_amount.should.equal(750000000000);
|
||||
info.transactions.should.equal(151);
|
||||
info.txouts.should.equal(151);
|
||||
});
|
||||
it('will get the best block hash', function() {
|
||||
var best = bitcoind.getBestBlockHash();
|
||||
best.should.equal(bestblock);
|
||||
});
|
||||
});
|
||||
|
||||
describe('get next block hash', function() {
|
||||
it('will get next block hash', function() {
|
||||
var nextBlockHash = bitcoind.getNextBlockHash(blockHashes[0]);
|
||||
|
|
|
@ -315,24 +315,6 @@ Bitcoin.prototype.getNextBlockHash = function(hash) {
|
|||
return bindings.getNextBlockHash(hash);
|
||||
};
|
||||
|
||||
/**
|
||||
* This query is expensive and can take quite a while to return. It will give
|
||||
* statistics about the database, in the format:
|
||||
* {
|
||||
* height: 151,
|
||||
* bestblock: '085241174bf5c9d606e591b3cbf52f9306f3d6aca50ea77604ca898472dc4669',
|
||||
* transactions: 151,
|
||||
* txouts: 151,
|
||||
* bytes_serialized: 10431,
|
||||
* hash_serialized: 'b1e42afb98d0d9f1978c048648685590a7ef0be46f83f509fc0d0668d6a39d8c',
|
||||
* total_amount: 750000000000
|
||||
* }
|
||||
* @returns {Object}
|
||||
*/
|
||||
Bitcoin.prototype.getTxOutSetInfo = function() {
|
||||
return bindings.getTxOutSetInfo();
|
||||
};
|
||||
|
||||
/**
|
||||
* This will return information about the database in the format:
|
||||
* {
|
||||
|
|
|
@ -207,27 +207,6 @@ NAN_METHOD(SyncPercentage) {
|
|||
info.GetReturnValue().Set(progress * 100);
|
||||
};
|
||||
|
||||
NAN_METHOD(GetTxOutSetInfo) {
|
||||
{
|
||||
LOCK(cs_main);
|
||||
CCoinsStats stats;
|
||||
FlushStateToDisk();
|
||||
if (pcoinsTip->GetStats(stats)) {
|
||||
Local<Object> obj = New<Object>();
|
||||
Set(obj, New("height").ToLocalChecked(), New<Number>((int64_t)stats.nHeight));
|
||||
Set(obj, New("bestblock").ToLocalChecked(), New(stats.hashBlock.GetHex().c_str()).ToLocalChecked());
|
||||
Set(obj, New("transactions").ToLocalChecked(), New<Number>((int64_t)stats.nTransactions));
|
||||
Set(obj, New("txouts").ToLocalChecked(), New<Number>((int64_t)stats.nTransactionOutputs));
|
||||
Set(obj, New("bytes_serialized").ToLocalChecked(), New<Number>((int64_t)stats.nSerializedSize));
|
||||
Set(obj, New("hash_serialized").ToLocalChecked(), New(stats.hashSerialized.GetHex()).ToLocalChecked());
|
||||
Set(obj, New("total_amount").ToLocalChecked(), New<Number>(stats.nTotalAmount));
|
||||
info.GetReturnValue().Set(obj);
|
||||
return;
|
||||
}
|
||||
}
|
||||
info.GetReturnValue().Set(Null());
|
||||
};
|
||||
|
||||
NAN_METHOD(GetBestBlockHash) {
|
||||
LOCK(cs_main);
|
||||
info.GetReturnValue().Set(New(chainActive.Tip()->GetBlockHash().GetHex()).ToLocalChecked());
|
||||
|
@ -1558,7 +1537,6 @@ NAN_MODULE_INIT(init) {
|
|||
Set(target, New("startTxMon").ToLocalChecked(), GetFunction(New<FunctionTemplate>(StartTxMon)).ToLocalChecked());
|
||||
Set(target, New("syncPercentage").ToLocalChecked(), GetFunction(New<FunctionTemplate>(SyncPercentage)).ToLocalChecked());
|
||||
Set(target, New("isSynced").ToLocalChecked(), GetFunction(New<FunctionTemplate>(IsSynced)).ToLocalChecked());
|
||||
Set(target, New("getTxOutSetInfo").ToLocalChecked(), GetFunction(New<FunctionTemplate>(GetTxOutSetInfo)).ToLocalChecked());
|
||||
Set(target, New("getBestBlockHash").ToLocalChecked(), GetFunction(New<FunctionTemplate>(GetBestBlockHash)).ToLocalChecked());
|
||||
Set(target, New("getNextBlockHash").ToLocalChecked(), GetFunction(New<FunctionTemplate>(GetNextBlockHash)).ToLocalChecked());
|
||||
}
|
||||
|
|
|
@ -408,7 +408,6 @@ describe('Bitcoin Service', function() {
|
|||
['getTransactionWithBlockInfo', 3],
|
||||
['getMempoolTransactions', 0],
|
||||
['addMempoolUncheckedTransaction', 1],
|
||||
['getTxOutSetInfo', 0],
|
||||
['getBestBlockHash', 0],
|
||||
['getNextBlockHash', 1],
|
||||
['getInfo', 0]
|
||||
|
|
Loading…
Reference in New Issue