Skip to content

Commit 0251913

Browse files
committed
rpcserver: skip calculating fee rate for PSBT funding
1 parent 79b2076 commit 0251913

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

rpcserver.go

+15-10
Original file line numberDiff line numberDiff line change
@@ -2100,17 +2100,22 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
21002100
return nil, fmt.Errorf("cannot open channel to self")
21012101
}
21022102

2103-
// Calculate an appropriate fee rate for this transaction.
2104-
feeRate, err := lnrpc.CalculateFeeRate(
2105-
uint64(in.SatPerByte), in.SatPerVbyte, // nolint:staticcheck
2106-
uint32(in.TargetConf), r.server.cc.FeeEstimator,
2107-
)
2108-
if err != nil {
2109-
return nil, err
2110-
}
2103+
var feeRate chainfee.SatPerKWeight
21112104

2112-
rpcsLog.Debugf("[openchannel]: using fee of %v sat/kw for funding tx",
2113-
int64(feeRate))
2105+
// Skip estimating fee rate for PSBT funding.
2106+
if in.FundingShim == nil || in.FundingShim.GetPsbtShim() == nil {
2107+
// Calculate an appropriate fee rate for this transaction.
2108+
feeRate, err = lnrpc.CalculateFeeRate(
2109+
uint64(in.SatPerByte), in.SatPerVbyte,
2110+
uint32(in.TargetConf), r.server.cc.FeeEstimator,
2111+
)
2112+
if err != nil {
2113+
return nil, err
2114+
}
2115+
2116+
rpcsLog.Debugf("[openchannel]: using fee of %v sat/kw for "+
2117+
"funding tx", int64(feeRate))
2118+
}
21142119

21152120
script, err := chancloser.ParseUpfrontShutdownAddress(
21162121
in.CloseAddress, r.cfg.ActiveNetParams.Params,

0 commit comments

Comments
 (0)