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

min confirmation set to 1 requires 2 confirmations #2547

Open
SimonVillage opened this issue May 7, 2020 · 2 comments
Open

min confirmation set to 1 requires 2 confirmations #2547

SimonVillage opened this issue May 7, 2020 · 2 comments

Comments

@SimonVillage
Copy link

When setting min_confirmation to 1 the following condition will be true even if the transaction already has 1 confirmation.

app/workers/daemons/blockchain.rb:22

if bc.reload.height + bc.min_confirmations >= bc_service.latest_block_number
  logger.info { "Skip synchronization. No new blocks detected, height: #{bc.height}, latest_block: #{bc_service.latest_block_number}." }
  logger.info { 'Sleeping for 10 seconds' }
  sleep(10)
  next
end

bc.reload.height = 100
bc.min_confirmations = 1
bc_service.latest_block_number = 101

if 100 + 1 >= 101

will be true because of equal so processing will be skipped.

@SimonVillage SimonVillage changed the title min confirmation set to 1 required 2 confirmations min confirmation set to 1 requires 2 confirmations May 7, 2020
@SimonVillage
Copy link
Author

SimonVillage commented May 9, 2020

@mnaichuk could you confirm this?

I wasn't sure if changing

if bc.reload.height + bc.min_confirmations >= bc_service.latest_block_number

would be enough in that case? I guess it's used more often?

@mnaichuk
Copy link
Member

Hello @SimonHausdorf, yes you are right if we will put 1 confirmation or more it will raise an error if latest_block_number == height + min_confirmation. How do you want to change it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants