Skip to content

Commit

Permalink
added a fix for destroyed change, not made by me.
Browse files Browse the repository at this point in the history
added a fix for insta-destroyed change that caused crashes in sync.js
fix made by rbtgit: their words from iquidus#56
"I've had this issue and fixed it by changing the following line in explorer.js:
if (vout[i].scriptPubKey.type != 'nonstandard' && vout[i].scriptPubKey.type != 'nulldata') {
to
if (vout[i].scriptPubKey.type != 'nonstandard' && vout[i].scriptPubKey.type != 'nulldata' && vout[i].scriptPubKey.hasOwnProperty("addresses")) { 
"
  • Loading branch information
MotorMan authored May 3, 2018
1 parent d3e86da commit 97cf3f2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,13 @@ module.exports = {
module.exports.syncLoop(vout.length, function (loop) {
var i = loop.iteration();
// make sure vout has an address
if (vout[i].scriptPubKey.type != 'nonstandard' && vout[i].scriptPubKey.type != 'nulldata') {
if (vout[i].scriptPubKey.type != 'nonstandard' && vout[i].scriptPubKey.type != 'nulldata' && vout[i].scriptPubKey.hasOwnProperty("addresses")) {
//if (vout[i].scriptPubKey.type != 'nonstandard' && vout[i].scriptPubKey.type != 'nulldata' && vout[i].scriptPubKey.type != 'create' && vout[i].scriptPubKey.type != 'call') {
//mm mod from pull to fix some bad blocks on some coin.
// check if vout address is unique, if so add it array, if not add its amount to existing index
//console.log('vout:' + i + ':' + txid);
module.exports.is_unique(arr_vout, vout[i].scriptPubKey.addresses[0], function(unique, index) {
//mm my crashing for cannot read property '0' of undefined happens on ^^^^^^ line, at that point.
if (unique == true) {
// unique vout
module.exports.convert_to_satoshi(parseFloat(vout[i].value), function(amount_sat){
Expand Down Expand Up @@ -340,7 +343,7 @@ module.exports = {
});
} else {
module.exports.get_rawtransaction(input.txid, function(tx){
if (tx) {
if (tx && tx.vout) { //mm mod from pull request for fixing locked file on crashes
module.exports.syncLoop(tx.vout.length, function (loop) {
var i = loop.iteration();
if (tx.vout[i].n == input.vout) {
Expand Down

1 comment on commit 97cf3f2

@Hser2bio
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks sir! work for me.

very useful

Please sign in to comment.