Permalink
Browse files

Moving to the new getblockheaderbyheight format

  • Loading branch information...
pmitchev
pmitchev committed May 14, 2018
1 parent 82a4b32 commit 7b796fadf0775d74ff420899fa3f1e70f13a9753
Showing with 11 additions and 4 deletions.
  1. +4 −2 README.md
  2. +2 −1 config.json → config_example.json
  3. +5 −1 lib/blockUnlocker.js
View
@@ -292,7 +292,8 @@ Explanation for each field:
/* Coin daemon connection details. */
"daemon": {
"host": "127.0.0.1",
"port": 29081
"port": 29081,
"legacy": false // Use 1 for forknote v2.1.2 or older
},
/* Wallet daemon connection details. */
@@ -311,7 +312,8 @@ Explanation for each field:
"monitoring": {
"daemon": {
"checkInterval": 60, //interval of sending rpcMethod request
"rpcMethod": "getblockcount" //RPC method name
"rpcMethod": "getblockcount", //RPC method name
"legacy": false // Use true if you use legacy version (before Forknote v2.1.2.1). For details: https://github.com/forknote/forknote-pool/issues/48
},
"wallet": {
"checkInterval": 60,
@@ -110,7 +110,8 @@
"daemon": {
"host": "127.0.0.1",
"port": 42081
"port": 42081,
"legacy": false
},
"wallet": {
View
@@ -45,7 +45,11 @@ function runInterval(){
//Check if blocks are orphaned
function(blocks, callback){
async.filter(blocks, function(block, mapCback){
apiInterfaces.rpcDaemon('getblockheaderbyheight', {height: block.height}, function(error, result){
var block_height = block.height + 1;
if (typeof config.daemon.legacy !== 'undefined' && config.daemon.legacy === true) {
var block_height = block.height
}
apiInterfaces.rpcDaemon('getblockheaderbyheight', {height: block_height}, function(error, result){
if (error){
log('error', logSystem, 'Error with getblockheaderbyheight RPC request for block %s - %j', [block.serialized, error]);
block.unlocked = false;

0 comments on commit 7b796fa

Please sign in to comment.