@@ -18,7 +18,7 @@ export default class CheckTx {
1818
1919 public check = async ( lockHashes : string [ ] ) : Promise < string [ ] > => {
2020 const outputs : Cell [ ] = this . filterOutputs ( lockHashes )
21- const inputAddresses = await this . filterInputs ( )
21+ const inputAddresses = await this . filterInputs ( lockHashes )
2222
2323 const outputAddresses : string [ ] = outputs . map ( output => {
2424 return LockUtils . lockScriptToAddress ( output . lock )
@@ -48,24 +48,23 @@ export default class CheckTx {
4848
4949 /* eslint no-await-in-loop: "off" */
5050 /* eslint no-restricted-syntax: "warn" */
51- public filterInputs = async ( ) : Promise < string [ ] > => {
51+ public filterInputs = async ( lockHashes : string [ ] ) : Promise < string [ ] > => {
5252 const inputs = this . tx . inputs !
5353
5454 const addresses : string [ ] = [ ]
5555 for ( const input of inputs ) {
5656 const outPoint : OutPoint = input . previousOutput
5757 const { cell } = outPoint
58- if ( ! cell ) {
59- break
60- }
61- const output = await getConnection ( )
62- . getRepository ( OutputEntity )
63- . findOne ( {
64- outPointTxHash : cell . txHash ,
65- outPointIndex : cell . index ,
66- } )
67- if ( output ) {
68- addresses . push ( LockUtils . lockScriptToAddress ( output . lock ) )
58+ if ( cell ) {
59+ const output = await getConnection ( )
60+ . getRepository ( OutputEntity )
61+ . findOne ( {
62+ outPointTxHash : cell . txHash ,
63+ outPointIndex : cell . index ,
64+ } )
65+ if ( output && lockHashes . includes ( output . lockHash ) ) {
66+ addresses . push ( LockUtils . lockScriptToAddress ( output . lock ) )
67+ }
6968 }
7069 }
7170
0 commit comments