From 332246897dff7868a60e33481714ebf01c00fee0 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 16 Mar 2021 14:22:00 +0100 Subject: [PATCH] batchtx: add self chan balance to channel output Because the self channel balance is added to the total leased amount and pushed to the taker by the maker, we also need to add it to the actual funding output. --- venue/batchtx/tx.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/venue/batchtx/tx.go b/venue/batchtx/tx.go index 4b7db032a..bb0ba4900 100644 --- a/venue/batchtx/tx.go +++ b/venue/batchtx/tx.go @@ -518,9 +518,12 @@ func (e *ExecutionContext) assembleBatchTx(orderBatch *matching.OrderBatch, orderDetails := matchedOrder.Details bid := orderDetails.Bid ask := orderDetails.Ask + + fundingAmount := orderDetails.Quote.TotalSatsCleared + + bid.SelfChanBalance _, fundingOutput, err := input.GenFundingPkScript( bid.MultiSigKey[:], ask.MultiSigKey[:], - int64(orderDetails.Quote.TotalSatsCleared), + int64(fundingAmount), ) if err != nil { return err