Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: BatchOpenChannel RPC will always use 6 confirmation target for the fee estimation #8895

Closed
ziggie1984 opened this issue Jul 4, 2024 · 3 comments · Fixed by #8896
Closed
Assignees
Labels
batch funding bug Unintended code behaviour
Milestone

Comments

@ziggie1984
Copy link
Collaborator

ziggie1984 commented Jul 4, 2024

Currently you cannot control the feerate when using the BatchOpenChannel API, it will default to a conftarget of 6.

Culprit lies here:

We excluded the fee estimation logic when using the psbt flow but the batchopen flow uses the psbt funding flow so we cannot do so.

lnd/rpcserver.go

Lines 2176 to 2195 in 71ba355

if in.FundingShim == nil || in.FundingShim.GetPsbtShim() == nil {
// Keep the old behavior prior to 0.18.0 - when the user
// doesn't set fee rate or conf target, the default conf target
// of 6 is used.
targetConf := maybeUseDefaultConf(
in.SatPerByte, in.SatPerVbyte, uint32(in.TargetConf),
)
// Calculate an appropriate fee rate for this transaction.
feeRate, err = lnrpc.CalculateFeeRate(
uint64(in.SatPerByte), in.SatPerVbyte,
targetConf, r.server.cc.FeeEstimator,
)
if err != nil {
return nil, err
}
rpcsLog.Debugf("[openchannel]: using fee of %v sat/kw for "+
"funding tx", int64(feeRate))
}

Moreover using pointer here, shadowed the bug unfortunately which caused us to use 6 rather then failing with an error.

https://github.com/lightningnetwork/lnd/blob/master/server.go#L4521-L4566

Going to provide a fix asap.

@ziggie1984 ziggie1984 added bug Unintended code behaviour batch funding labels Jul 4, 2024
@ziggie1984 ziggie1984 added this to the v0.18.2 milestone Jul 4, 2024
@ziggie1984 ziggie1984 self-assigned this Jul 4, 2024
@ziggie1984 ziggie1984 changed the title [bug]: BatchOpenChannel RPC always will use 6 confirmation target for the fee estimation [bug]: BatchOpenChannel RPC will always use 6 confirmation target for the fee estimation Jul 4, 2024
@bitromortac
Copy link
Collaborator

Does it ignore the target field? Setting SatPerVbyte seems to work for me.

@ziggie1984
Copy link
Collaborator Author

ziggie1984 commented Jul 4, 2024

it ignores the whole fee calc., can you verify that your selected feerate and the fee estimation of 6 blocks did not by incident just were the same ?

Its a bug introduced in 18, so it would work just fine with 17

@bitromortac
Copy link
Collaborator

Right that could be the case, will double check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
batch funding bug Unintended code behaviour
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants