Exemplo n.º 1
0
        private void OnCommitmentTransaction(LocalChannel channel, Transaction spendingTx)
        {
            var oldState = channel.State;

            _channelLoggingService.LogWarning(channel, "Unilateral Close: A commitment transaction got confirmed.", spendingTx.ToString());
            _unilateralCloseService.HandleUnilateralClose(channel, spendingTx);
            channel.State = LocalChannelState.Closed;
            _channelLoggingService.LogStateUpdate(channel, oldState);
            _channelService.RemoveChannel(channel);
        }
Exemplo n.º 2
0
        public void HandleRemoteFundingLocked(IPeer peer, FundingLockedMessage message, LocalChannel channel)
        {
            if (channel.State == LocalChannelState.NormalOperation && channel.RemoteCommitmentTxParameters.TransactionNumber == 0)
            {
                _channelLoggingService.LogInfo(channel, $"Remote sent us a {nameof(FundingLockedMessage)} but we are already in Normal Operation state. " +
                                               "We will answer with a funding locked message.");
                SendFundingLocked(peer, channel);
                return;
            }

            if (channel.State != LocalChannelState.FundingSigned && channel.State != LocalChannelState.FundingLocked)
            {
                _channelLoggingService.LogWarning(channel, $"Remote sent us a {nameof(FundingLockedMessage)}, but the current state is {channel.State}");
                return;
            }

            channel.State = channel.State == LocalChannelState.FundingLocked ? LocalChannelState.NormalOperation : LocalChannelState.FundingLocked;
            channel.RemoteCommitmentTxParameters.NextPerCommitmentPoint = message.NextPerCommitmentPoint;
        }