private async Task <IBitcoinBasedTransaction> CreateRefundTxAsync( Swap swap, IBitcoinBasedTransaction paymentTx, string refundAddress, DateTimeOffset lockTime, byte[] redeemScript) { Log.Debug("Create refund tx for swap {@swapId}", swap.Id); var currency = Currencies.Get <BitcoinBasedCurrency>(Currency); var amountInSatoshi = currency.CoinToSatoshi(AmountHelper.QtyToAmount(swap.Side, swap.Qty, swap.Price, currency.DigitsMultiplier)); var tx = await _transactionFactory .CreateSwapRefundTxAsync( paymentTx : paymentTx, amount : amountInSatoshi, refundAddress : refundAddress, lockTime : lockTime, redeemScript : redeemScript) .ConfigureAwait(false); if (tx == null) { throw new InternalException( code: Errors.TransactionCreationError, description: $"Refund tx creation error for swap {swap.Id}"); } tx.Type = BlockchainTransactionType.Output | BlockchainTransactionType.SwapRefund; Log.Debug("Refund tx successfully created for swap {@swapId}", swap.Id); return(tx); }
private async Task <IBitcoinBasedTransaction> CreateRefundTxAsync( ClientSwap swap, IBitcoinBasedTransaction paymentTx, string refundAddress, DateTimeOffset lockTime) { Log.Debug("Create refund tx for swap {@swapId}", swap.Id); var tx = await _transactionFactory .CreateSwapRefundTxAsync( paymentTx : paymentTx, swap : swap, refundAddress : refundAddress, lockTime : lockTime) .ConfigureAwait(false); if (tx == null) { throw new InternalException( code: Errors.TransactionCreationError, description: $"Refund tx creation error for swap {swap.Id}"); } Log.Debug("Refund tx successfully created for swap {@swapId}", swap.Id); return(tx); }