@@ -53,6 +53,11 @@ const (
5353 // level ACK from the remote party before timing out.
5454 ackTimeout = time .Second * 30
5555
56+ // proofCourierCheckTimeout is the amount of time we'll wait before we
57+ // time out an attempt to connect to a proof courier when checking the
58+ // configured address.
59+ proofCourierCheckTimeout = time .Second * 5
60+
5661 // maxNumAssetIDs is the maximum number of fungible asset pieces (asset
5762 // IDs) that can be committed to a single channel. The number needs to
5863 // be limited to prevent the number of required HTLC signatures to be
@@ -1373,7 +1378,7 @@ func (f *FundingController) processFundingMsg(ctx context.Context,
13731378 // We can only support asset channels if we have the correct proof
13741379 // courier type configured, so we're ready to receive the channel funds
13751380 // once the channel is (force) closed.
1376- if err := f .validateLocalProofCourier (); err != nil {
1381+ if err := f .validateLocalProofCourier (ctx ); err != nil {
13771382 return tempPID , fmt .Errorf ("unable to accept channel funding " +
13781383 "request, local proof courier is invalid: %w" , err )
13791384 }
@@ -1542,7 +1547,7 @@ func (f *FundingController) processFundingReq(fundingFlows fundingFlowIndex,
15421547
15431548 // We need to make sure we're ready to receive the channel funds once
15441549 // the channel is (force) closed.
1545- if err := f .validateLocalProofCourier (); err != nil {
1550+ if err := f .validateLocalProofCourier (fundReq . ctx ); err != nil {
15461551 return fmt .Errorf ("unable to fund channel, local proof " +
15471552 "courier is invalid: %w" , err )
15481553 }
@@ -2070,7 +2075,9 @@ func (f *FundingController) validateWitness(outAsset asset.Asset,
20702075// universe based proof courier configured. A hashmail based courier can't deal
20712076// with the OP_TRUE funding output script key, as that's the same for asset
20722077// channels out there. So the single mailbox would always be occupied.
2073- func (f * FundingController ) validateLocalProofCourier () error {
2078+ func (f * FundingController ) validateLocalProofCourier (
2079+ ctx context.Context ) error {
2080+
20742081 courierURL := f .cfg .DefaultCourierAddr
20752082
20762083 flagHelp := "please set a universe based (universerpc://) proof " +
@@ -2090,7 +2097,9 @@ func (f *FundingController) validateLocalProofCourier() error {
20902097 courierURL .Scheme , flagHelp )
20912098 }
20922099
2093- return nil
2100+ return proof .CheckUniverseRpcCourierConnection (
2101+ ctx , proofCourierCheckTimeout , courierURL ,
2102+ )
20942103}
20952104
20962105// FundReq is a message that's sent to the funding controller to request a new
0 commit comments