From f76427922f00b2856c7116b0d5f352b063e21b84 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Mon, 12 Feb 2018 19:13:43 +0300 Subject: [PATCH] spv beer, pizza, vote; elections missing var check --- routes/electrumjs/electrumServers.js | 33 ++++++++++++++++++++++++++++ routes/shepherd/elections.js | 16 +++++++++----- routes/shepherd/electrum/network.js | 6 +++++ 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/routes/electrumjs/electrumServers.js b/routes/electrumjs/electrumServers.js index d115c1b..19037d4 100644 --- a/routes/electrumjs/electrumServers.js +++ b/routes/electrumjs/electrumServers.js @@ -158,6 +158,39 @@ let electrumServers = { 'electrum2.cipig.net:10020' ], }, + beer: { // !estimatefee + address: 'electrum1.cipig.net', + port: 10022, + proto: 'tcp', + txfee: 10000, + abbr: 'BEER', + serverList: [ + 'electrum1.cipig.net:10022', + 'electrum2.cipig.net:10022' + ], + }, + pizza: { // !estimatefee + address: 'electrum1.cipig.net', + port: 10024, + proto: 'tcp', + txfee: 10000, + abbr: 'PIZZA', + serverList: [ + 'electrum1.cipig.net:10024', + 'electrum2.cipig.net:10024' + ], + }, + vote: { // !estimatefee + address: 'electrum1.cipig.net', + port: 10021, + proto: 'tcp', + txfee: 10000, + abbr: 'VOTE', + serverList: [ + 'electrum1.cipig.net:10021', + 'electrum2.cipig.net:10021' + ], + }, jumblr: { // !estimatefee address: 'electrum1.cipig.net', port: 10004, diff --git a/routes/shepherd/elections.js b/routes/shepherd/elections.js index 58f2714..d64ce5e 100644 --- a/routes/shepherd/elections.js +++ b/routes/shepherd/elections.js @@ -141,12 +141,16 @@ module.exports = (shepherd) => { let _opreturnFound = false; let _region; - for (let i = 0; i < decodedTx.outputs.length; i++) { - if (decodedTx.outputs[i].scriptPubKey.asm.indexOf('OP_RETURN') > -1) { - _opreturnFound = true; - _region = shepherd.hex2str(decodedTx.outputs[i].scriptPubKey.hex.substr(4, decodedTx.outputs[i].scriptPubKey.hex.length)); - shepherd.log(`found opreturn tag ${_region}`); - break; + if (decodedTx && + decodedTx.outputs && + decodedTx.outputs.length) { + for (let i = 0; i < decodedTx.outputs.length; i++) { + if (decodedTx.outputs[i].scriptPubKey.asm.indexOf('OP_RETURN') > -1) { + _opreturnFound = true; + _region = shepherd.hex2str(decodedTx.outputs[i].scriptPubKey.hex.substr(4, decodedTx.outputs[i].scriptPubKey.hex.length)); + shepherd.log(`found opreturn tag ${_region}`); + break; + } } } diff --git a/routes/shepherd/electrum/network.js b/routes/shepherd/electrum/network.js index 594c6d5..aa4bd98 100644 --- a/routes/shepherd/electrum/network.js +++ b/routes/shepherd/electrum/network.js @@ -61,6 +61,9 @@ module.exports = (shepherd) => { coin === 'MNZ' || coin === 'BTCH' || coin === 'KMD' || + coin === 'BEER' || + coin === 'PIZZA' || + coin === 'VOTE' || coin === 'KOMODO' || coinUC === 'SUPERNET' || coinUC === 'REVS' || @@ -83,6 +86,9 @@ module.exports = (shepherd) => { coinUC === 'WLC' || coinUC === 'MNZ' || coinUC === 'BTCH' || + coinUC === 'BEER' || + coinUC === 'PIZZA' || + coinUC === 'VOTE' || coinUC === 'KMD' || coinUC === 'KOMODO') { return shepherd.electrumJSNetworks.komodo;