-
Notifications
You must be signed in to change notification settings - Fork 992
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 next available key on duplicate coinbase commitment #2737
Use next available key on duplicate coinbase commitment #2737
Conversation
If a coinbase commitment hits a duplication and there is no transactions to mine, it is possible that coinbase cannot be built for quite a long time. This change tries to build coinbase with an empty key identifier immediately in this case. The listening wallet will then use the next available key to build a coinbase commitment, which is different from the previous one and is unlikely to hit the duplication.
Thanks for your 1st PR 👍 Could you please share more info? |
perhaps #1491 related. |
match e { | ||
self::Error::Chain(c) => match c.kind() { | ||
chain::ErrorKind::DuplicateCommitment(_) => { | ||
debug!( | ||
"Duplicate commit for potential coinbase detected. Trying next derivation." | ||
); | ||
// use the next available key to generate a different coinbase commitment | ||
new_key_id = None; |
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.
👍
We have met this in production some time (stratum server stucks for hours). The commitment seems only depend on the amount and the key itself (please correct me if I am wrong). If we hit the duplication and there is no transactions, the amount will always be just the coinbase reward itself. If we do not change the key, the commitment does not change until there is a transaction (amount changes as there are transaction fees). Hence the coinbase cannot be successfully built and stratum server stalls. |
If a coinbase commitment hits a duplication and there is no transactions to mine, it is possible that coinbase cannot be built for quite a long time. This change tries to build coinbase with an empty key identifier immediately in this case. The listening wallet will then use the next available key to build a coinbase commitment, which is different from the previous one and is unlikely to hit the duplication.