Ejemplo n.º 1
0
        private async Task ProcessBlock(int height, ISet <string> observableAddresses)
        {
            _log.Info("Processing block", context: new { Height = height });

            var txOutputAddresses = await _blockChainProvider.GetTxOutputAddresses(height);

            var involvedInTxAddresses = new List <string>();

            foreach (var tx in txOutputAddresses)
            {
                if (tx.destinationAddresses.Any(txOutAddress => txOutAddress == _hotWalletAddressSettings.HotWalletAddress ||
                                                observableAddresses.Contains(txOutAddress)))
                {
                    _log.Info("Detected lykke related transaction in block", context: new { Height = height, TransactionHash = tx.txHash });
                    involvedInTxAddresses.AddRange(await _blockChainProvider.GetInvolvedInTxAddresses(tx.txHash));
                }
            }

            foreach (var address in involvedInTxAddresses
                     .Where(addr => observableAddresses.Contains(addr))
                     .Distinct())
            {
                _log.Info("Detected lykke related address in block", context: new { Height = height, Address = address });
                await _walletBalanceService.UpdateBalanceAsync(address, _confirmationsSettings.MinConfirmationsToDetectOperation);
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> ForceUpdateBalance(string address)
        {
            _log.Warning("Force updating the balance", context: new
            {
                Address = address,
                MinConfirmationsToDetectOperation = _confirmationsSettings.MinConfirmationsToDetectOperation
            });

            await _balanceService.UpdateBalanceAsync(address, _confirmationsSettings.MinConfirmationsToDetectOperation);

            return(Ok());
        }