@@ -906,19 +906,14 @@ AddressService.prototype.getAddressSummary = function(address, options, callback
906906
907907 var outputs ;
908908 var inputs ;
909- var mempoolInputs ;
910909
911910 async . parallel (
912911 [
913912 function ( next ) {
914- if ( options . noTxList ) {
915- setImmediate ( next ) ;
916- } else {
917- self . getInputs ( address , opt , function ( err , ins ) {
918- inputs = ins ;
919- next ( err ) ;
920- } ) ;
921- }
913+ self . getInputs ( address , opt , function ( err , ins ) {
914+ inputs = ins ;
915+ next ( err ) ;
916+ } ) ;
922917 } ,
923918 function ( next ) {
924919 self . getOutputs ( address , opt , function ( err , outs ) {
@@ -936,8 +931,8 @@ AddressService.prototype.getAddressSummary = function(address, options, callback
936931 var totalSpent = 0 ;
937932 var balance = 0 ;
938933 var unconfirmedBalance = 0 ;
939- var appearances = 0 ;
940- var unconfirmedAppearances = 0 ;
934+ var appearanceIds = { } ;
935+ var unconfirmedAppearanceIds = { } ;
941936 var txids = [ ] ;
942937
943938 for ( var i = 0 ; i < outputs . length ; i ++ ) {
@@ -951,33 +946,38 @@ AddressService.prototype.getAddressSummary = function(address, options, callback
951946 if ( outputs [ i ] . confirmations ) {
952947 totalReceived += outputs [ i ] . satoshis ;
953948 balance += outputs [ i ] . satoshis ;
954- appearances ++ ;
949+ appearanceIds [ outputs [ i ] . txid ] = true ;
955950 } else {
956- unconfirmedAppearances ++ ;
951+ unconfirmedAppearanceIds [ outputs [ i ] . txid ] = true ;
957952 }
958953
959954 if ( spentDB || spentMempool ) {
960955 unconfirmedBalance -= outputs [ i ] . satoshis ;
961956 if ( spentDB ) {
962957 totalSpent += outputs [ i ] . satoshis ;
963958 balance -= outputs [ i ] . satoshis ;
964- appearances ++ ;
965- } else {
966- unconfirmedAppearances ++ ;
967959 }
968960 }
969961 }
970962
963+ for ( var j = 0 ; j < inputs . length ; j ++ ) {
964+ if ( inputs [ j ] . confirmations ) {
965+ appearanceIds [ inputs [ j ] . txid ] = true ;
966+ } else {
967+ unconfirmedAppearanceIds [ outputs [ j ] . txid ] = true ;
968+ }
969+ }
970+
971971 var summary = {
972972 totalReceived : totalReceived ,
973973 totalSpent : totalSpent ,
974974 balance : balance ,
975975 unconfirmedBalance : unconfirmedBalance ,
976- appearances : appearances ,
977- unconfirmedAppearances : unconfirmedAppearances
976+ appearances : Object . keys ( appearanceIds ) . length ,
977+ unconfirmedAppearances : Object . keys ( unconfirmedAppearanceIds ) . length
978978 } ;
979979
980- if ( inputs ) {
980+ if ( ! options . noTxList ) {
981981 for ( var i = 0 ; i < inputs . length ; i ++ ) {
982982 txids . push ( inputs [ i ] ) ;
983983 }
0 commit comments