Skip to content

Commit

Permalink
fix "Cannot read property 'scriptPubKey' of undefined" error
Browse files Browse the repository at this point in the history
For some zcash-based coins or kmd-assets is needed to handle
a tx without any inputs or outputs, here we do additional check
if vout[0] is exists.
  • Loading branch information
DeckerSU committed Nov 5, 2017
1 parent c8ac131 commit ac74e41
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,12 @@ module.exports = {
loop.next();
}
}, function(){
if (vout[0].scriptPubKey.type == 'nonstandard') {

if (!vout[0]) {
return cb(arr_vout, arr_vin);
}

if (vout[0].scriptPubKey.type == 'nonstandard') {
if ( arr_vin.length > 0 && arr_vout.length > 0 ) {
if (arr_vin[0].addresses == arr_vout[0].addresses) {
//PoS
Expand Down

0 comments on commit ac74e41

Please sign in to comment.