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

Use bitcoin core's logic for anti-fee-sniping #120

Merged
merged 1 commit into from
Oct 15, 2023

Conversation

benthecarman
Copy link
Contributor

Since ldk sample uses core's wallet, would make sense to copy its fee sniping logic

@benthecarman benthecarman force-pushed the fee-sniping branch 2 times, most recently from e52e372 to b448c1a Compare September 25, 2023 03:44
src/sweep.rs Outdated
// 10% of the time
if thread_rng().gen_range(0, 10) == 0 {
// subtract random number between 0 and 100
cur_height -= thread_rng().gen_range(0, 100);
Copy link
Contributor

@tnull tnull Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's generally worth (after all this is just a sample..), but if we go that way this should be saturated_sub to make sure we're never underflowing.

Copy link
Contributor Author

@benthecarman benthecarman Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically should be safe because you can't spend coins until the 101st block.

Can add tho

Copy link
Contributor

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@TheBlueMatt TheBlueMatt merged commit 828df53 into lightningdevkit:main Oct 15, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants