rpcserver: skip calculating fee rate for PSBT funding

This commit is contained in:
yyforyongyu
2024-01-26 11:27:12 +08:00
parent 519a8749ef
commit 61e9c11881

View File

@ -2130,17 +2130,22 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
return nil, fmt.Errorf("cannot open channel to self") return nil, fmt.Errorf("cannot open channel to self")
} }
var feeRate chainfee.SatPerKWeight
// Skip estimating fee rate for PSBT funding.
if in.FundingShim == nil || in.FundingShim.GetPsbtShim() == nil {
// Calculate an appropriate fee rate for this transaction. // Calculate an appropriate fee rate for this transaction.
feeRate, err := lnrpc.CalculateFeeRate( feeRate, err = lnrpc.CalculateFeeRate(
uint64(in.SatPerByte), in.SatPerVbyte, // nolint:staticcheck uint64(in.SatPerByte), in.SatPerVbyte,
uint32(in.TargetConf), r.server.cc.FeeEstimator, uint32(in.TargetConf), r.server.cc.FeeEstimator,
) )
if err != nil { if err != nil {
return nil, err return nil, err
} }
rpcsLog.Debugf("[openchannel]: using fee of %v sat/kw for funding tx", rpcsLog.Debugf("[openchannel]: using fee of %v sat/kw for "+
int64(feeRate)) "funding tx", int64(feeRate))
}
script, err := chancloser.ParseUpfrontShutdownAddress( script, err := chancloser.ParseUpfrontShutdownAddress(
in.CloseAddress, r.cfg.ActiveNetParams.Params, in.CloseAddress, r.cfg.ActiveNetParams.Params,