get block difficulty

This commit is contained in:
Patrick Nagurny 2015-09-09 10:31:09 -04:00
parent bd8ed3bddf
commit 0e538f2e06
3 changed files with 3 additions and 5 deletions

View File

@ -49,7 +49,7 @@ BlockController.prototype.transformBlock = function(block, info) {
time: blockObj.header.time,
nonce: blockObj.header.nonce,
bits: blockObj.header.bits.toString(16),
difficulty: 0, // placeholder
difficulty: block.header.getDifficulty(),
chainwork: info.chainWork,
previousblockhash: blockObj.header.prevHash,
nextblockhash: null, // placeholder

View File

@ -57,7 +57,7 @@
"bitcoreNode": "lib",
"dependencies": {
"async": "*",
"bitcore": "^0.13.2",
"bitcore": "^0.13.3",
"lodash": "^2.4.1"
},
"devDependencies": {

View File

@ -67,9 +67,7 @@ describe('Blocks', function() {
var bitcoreBlock = bitcore.Block.fromBuffer(new Buffer(blocks['0000000000000afa0c3c0afd450c793a1e300ec84cbe9555166e06132f19a8f7'], 'hex'));
var todos = {
difficulty: 1295829.93087696,
nextblockhash: '000000000001e866a8057cde0c650796cb8a59e0e6038dc31c69d7ca6649627d',
reward: 12.5
nextblockhash: '000000000001e866a8057cde0c650796cb8a59e0e6038dc31c69d7ca6649627d'
};
var node = {