Issue #12: Fetching all on-chain txs and filtering based on user's address. Note: This permits running LndHub without -deprecatedrpc=accounts switch.
This commit is contained in:
		
							parent
							
								
									70262b1059
								
							
						
					
					
						commit
						16c6d167da
					
				@ -285,11 +285,11 @@ export class User {
 | 
				
			|||||||
      addr = await this.getAddress();
 | 
					      addr = await this.getAddress();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (!addr) throw new Error('cannot get transactions: no onchain address assigned to user');
 | 
					    if (!addr) throw new Error('cannot get transactions: no onchain address assigned to user');
 | 
				
			||||||
    let txs = await this._bitcoindrpc.request('listtransactions', [addr, 100500, 0, true]);
 | 
					    let txs = await this._bitcoindrpc.request('listtransactions', ['*', 100500, 0, true]);
 | 
				
			||||||
    txs = txs.result;
 | 
					    txs = txs.result;
 | 
				
			||||||
    let result = [];
 | 
					    let result = [];
 | 
				
			||||||
    for (let tx of txs) {
 | 
					    for (let tx of txs) {
 | 
				
			||||||
      if (tx.confirmations >= 3) {
 | 
					      if (tx.confirmations >= 3 && tx.address === addr) {
 | 
				
			||||||
        tx.type = 'bitcoind_tx';
 | 
					        tx.type = 'bitcoind_tx';
 | 
				
			||||||
        result.push(tx);
 | 
					        result.push(tx);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -335,11 +335,11 @@ export class User {
 | 
				
			|||||||
      addr = await this.getAddress();
 | 
					      addr = await this.getAddress();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (!addr) throw new Error('cannot get transactions: no onchain address assigned to user');
 | 
					    if (!addr) throw new Error('cannot get transactions: no onchain address assigned to user');
 | 
				
			||||||
    let txs = await this._bitcoindrpc.request('listtransactions', [addr, 100500, 0, true]);
 | 
					    let txs = await this._bitcoindrpc.request('listtransactions', ['*', 100500, 0, true]);
 | 
				
			||||||
    txs = txs.result;
 | 
					    txs = txs.result;
 | 
				
			||||||
    let result = [];
 | 
					    let result = [];
 | 
				
			||||||
    for (let tx of txs) {
 | 
					    for (let tx of txs) {
 | 
				
			||||||
      if (tx.confirmations < 3) {
 | 
					      if (tx.confirmations < 3 && tx.address === addr) {
 | 
				
			||||||
        result.push(tx);
 | 
					        result.push(tx);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user