private void BroadcastTransaction(CounterChainSession counterChainSession) { //TODO: can remove this? if (this.fullnode.State == FullNodeState.Disposed || this.fullnode.State == FullNodeState.Disposing) { this.logger.LogInformation("Full node disposing during broadcast. Do nothing."); return; } this.logger.LogTrace("()"); this.logger.LogInformation("Combine partials and broadcast transaction."); counterChainSession.PartialTransactions.ToList() .ForEach(t => this.logger.LogInformation(t.ToString())); var partials = from t in counterChainSession.PartialTransactions where t != null select t; var combinedTransaction = this.federationWalletManager.GetWallet().CombinePartialTransactions(partials.ToArray()); this.logger.LogInformation("Combined transaction: {0}", combinedTransaction); this.broadcastManager.BroadcastTransactionAsync(combinedTransaction).GetAwaiter().GetResult(); this.logger.LogTrace("(-)"); }
// Add the session to its collection. private void RegisterSession(int blockHeight, List <CounterChainTransactionInfoRequest> counterChainTransactionInfos) { this.logger.LogTrace("({0}:'{1}',{2}:'{3}')", nameof(blockHeight), blockHeight, "Transactions Count", counterChainTransactionInfos.Count); var counterChainSession = new CounterChainSession(this.logger, this.federationGatewaySettings, blockHeight); counterChainSession.CrossChainTransactions = counterChainTransactionInfos.Select(c => new CrossChainTransactionInfo { BlockNumber = blockHeight, TransactionHash = c.TransactionHash, DestinationAddress = c.DestinationAddress, Amount = c.Amount }).ToList(); this.sessions.AddOrReplace(blockHeight, counterChainSession); }
///<inheritdoc/> public void MarkSessionAsSigned(CounterChainSession session) { //TODO: this should be locked. the sessions are 30 seconds apart but network conditions could cause a collision. this.logger.LogInformation("has signed session for block {0}.", session.BlockHeight); session.HaveISigned = true; }