Skip to content

Commit

Permalink
batchtx: add self chan balance to channel output
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
guggero committed Mar 16, 2021
1 parent e5625d7 commit 3322468
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion venue/batchtx/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3322468

Please sign in to comment.