-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
sweep: allow force sweeping of negatively yielding inputs #3809
sweep: allow force sweeping of negatively yielding inputs #3809
Conversation
b82c3f7
to
3964624
Compare
3136500
to
1319eff
Compare
2bfce68
to
d7a2265
Compare
@joostjager Will this PR solve the use case where channel was closed with small local balance? |
339d292
to
0178cea
Compare
With an input of that size, the idea is to modify the sweep fee rate to a lower value using the Note that the sweeper uses fee rate buckets to batch inputs together. The first bucket is 1-10 sat/byte. The actual sweep fee rate is the average of all inputs in a bucket. If your input is the only input in the 1-10 bucket and you've lowered the input fee rate preference to 1 sat/b, it should be swept at that rate. This PR is not adding anything to that. It mainly allows negatively yielding inputs to be swept using the force flag, but for that you also need a wallet utxo. |
ffed1e5
to
0a31880
Compare
…eeps Previously only the fee rate used for the last sweep (the sweep bucket average) was reported. This commit adds the request fee preference to the report, which is used to select a bucket and the sweep tx fee rate.
7cb17d1
to
b114491
Compare
b114491
to
f4af657
Compare
Note to self: @cfromknecht suggested to require regular inputs to not just be positively yielding, but yield at least 2/3 (for example) of their value |
f4af657
to
99be3a2
Compare
Checked what is needed for that minimum yield requirement. The sweeper change is small, but there are quite a few changes in the test (setup) required. Leaving that change for a separate pr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice small change! Will give it another pass, but LGTM so far.
99be3a2
to
79ebcb8
Compare
Comments processed, ready for another pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR :)
} | ||
// Initialize new wallet total with the current wallet total. This is | ||
// updated below if this input is a wallet input. | ||
newWalletTotal := t.walletInputTotal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like the handling of this field can stay inside the switch case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it outside, because otherwise you have to be very careful not to update t.walletInputTotal
before you do any additional checks. In that case, the total would be updated without the add happening.
@@ -142,24 +151,14 @@ func bumpFee(ctx *cli.Context) error { | |||
return err | |||
} | |||
|
|||
var confTarget, satPerByte uint32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove this validation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The server already validates this, so this is just unnecessary maintenance. Change was suggested by @wpaulino and I liked it.
This is a preparation for adding additional parameters besides the fee preference.
This refactor prepares for the addition of specific constraints for force sweep inputs.
79ebcb8
to
b0aae13
Compare
Holding off merge until 0.9 final is cut. |
This PR adds force sweep functionality to the sweeper. Force sweep signals that an input needs to be swept even if its yield is negative. This is useful in CPFP scenarios where the parent tx output is only small. This will be common in the upcoming new anchor outputs commitment format.
The force flag is exposed on the
BumpFee
rpc call and throughlncli
. In many cases it will be required to have a wallet utxo available to bring the tx output above the dust limit. PR #3814 extended the sweeper with the capability to attach wallet utxos if needed.