class/User.js
/**
   * Fetches all onchain txs for user's address, and compares them to
   * already imported txids (stored in database); Ones that are not imported -
   * get their balance added to user's balance, and its txid added to 'imported' list.
   *
   * @returns {Promise<void>}
   */
Fetches all onchain txs for user's address, and compares them to
already imported txids (stored in database); Ones that are not imported
get their balance added to user's balance, and its txid added to 'imported' list.

@returns {Promise}
Fetches all onchain txs for user ' s address and compares them to already imported txids ( stored in database ) ; Ones that are not imported get their balance added to user ' s balance and its txid added to ' imported ' list . @returns { Promise }
async accountForPosibleTxids() {
    return; 
    let onchain_txs = await this.getTxs();
    let imported_txids = await this._redis.lrange('imported_txids_for_' + this._userid, 0, -1);
    for (let tx of onchain_txs) {
      if (tx.type !== 'bitcoind_tx') continue;
      let already_imported = false;
      for (let imported_txid of imported_txids) {
        if (tx.txid === imported_txid) already_imported = true;
      }
      if (!already_imported && tx.category === 'receive') {
        let lock = new Lock(this._redis, 'importing_' + tx.txid);
        if (!(await lock.obtainLock())) {
          return;
        }
        let userBalance = await this.getCalculatedBalance();
        await this.saveBalance(userBalance);
        await this._redis.rpush('imported_txids_for_' + this._userid, tx.txid);
        await lock.releaseLock();
      }
    }
  }
async accountForPosibleTxids ( ) { return ; let onchain_txs = await this . getTxs ( ) ; let imported_txids = await this . _redis . lrange ( 'imported_txids_for_' + this . _userid , 0 , - 1 ) ; for ( let tx of onchain_txs ) { if ( tx . type !== 'bitcoind_tx' ) continue ; let already_imported = false ; for ( let imported_txid of imported_txids ) { if ( tx . txid === imported_txid ) already_imported = true ; } if ( ! already_imported && tx . category === 'receive' ) { let lock = new Lock ( this . _redis , 'importing_' + tx . txid ) ; if ( ! ( await lock . obtainLock ( ) ) ) { return ; } let userBalance = await this . getCalculatedBalance ( ) ; await this . saveBalance ( userBalance ) ; await this . _redis . rpush ( 'imported_txids_for_' + this . _userid , tx . txid ) ; await lock . releaseLock ( ) ; } } }
Fetches all onchain txs for user's address, and compares them to
 already imported txids (stored in database); Ones that are not imported
 get their balance added to user's balance, and its txid added to 'imported' list.
Fetches all onchain txs for user ' s address and compares them to already imported txids ( stored in database ) ; Ones that are not imported get their balance added to user ' s balance and its txid added to ' imported ' list .
// TODO: remove // first, locking... // someone's already importing this tx // userBalance += new BigNumber(tx.amount).multipliedBy(100000000).toNumber(); // no need to add since it was accounted for in `this.getCalculatedBalance()`