From 33c04894a044bfe6f88b6cc63aa5ada8ce6e2c36 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Fri, 19 Mar 2021 16:49:07 +0100 Subject: [PATCH] funding: skip match prepare part as sidecar provider If we're the provider of a sidecar channel we don't have to register a funding shim or connect out to the taker. We'll just have to provide the signature in the next step. --- funding/manager.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/funding/manager.go b/funding/manager.go index 734c7c2..87142d7 100644 --- a/funding/manager.go +++ b/funding/manager.go @@ -512,6 +512,18 @@ func (m *Manager) PrepChannelFunding(batch *order.Batch, continue } + // If we are the provider for a sidecar ticket, we don't + // have to do anything either in this step. + ourOrderBid, ourOrderIsBid := ourOrder.(*order.Bid) + if ourOrderIsBid && ourOrderBid.SidecarTicket != nil { + r := ourOrderBid.SidecarTicket.Recipient + if r != nil && + !m.cfg.NodePubKey.IsEqual(r.NodePubKey) { + + continue + } + } + // As the bidder, we're the one that needs to make the // connection as we're possibly not reachable from the // outside. Let's kick off the connection now. However @@ -550,8 +562,7 @@ func (m *Manager) PrepChannelFunding(batch *order.Batch, // phase w/o any issues and accept the incoming channel // from the asker. err := m.registerFundingShim( - ourOrder.(*order.Bid), matchedOrder, - batch.BatchTX, + ourOrderBid, matchedOrder, batch.BatchTX, ) if err != nil { return fmt.Errorf("unable to register funding "+