Skip to content

Commit 4b1854d

Browse files
committed
tapchannel: send funding err to remote on failure
If we fail to fund the channel (for example because we don't have enough BTC or asset funds), we inform the remote about it, so they can remove the pending channel from their in-memory state and allow us to try again.
1 parent 9297f0f commit 4b1854d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tapchannel/aux_funding_controller.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"context"
66
crand "crypto/rand"
7+
"errors"
78
"fmt"
89
"io"
910
"net/url"
@@ -1442,6 +1443,19 @@ func (f *FundingController) processFundingReq(fundingFlows fundingFlowIndex,
14421443
uErr)
14431444
}
14441445

1446+
// If anything went wrong during the funding process,
1447+
// the remote side might have an in-memory state and
1448+
// wouldn't allow us to try again within the next 10
1449+
// minutes (due to only one pending channel per peer
1450+
// default value). To avoid running into this issue, we
1451+
// make sure to inform the remote about us aborting the
1452+
// channel. We don't send them the actual error though,
1453+
// that would give away too much information.
1454+
f.cfg.ErrReporter.ReportError(
1455+
fundReq.ctx, fundReq.PeerPub, tempPID,
1456+
errors.New("internal error"),
1457+
)
1458+
14451459
fundReq.errChan <- err
14461460
return
14471461
}

0 commit comments

Comments
 (0)