-
Notifications
You must be signed in to change notification settings - Fork 138
tapchannel+tapfreighter: add parcel height hint #1920
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @jtobin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the transaction confirmation process by introducing an optional block height hint within the Parcel interface. This allows the ChainPorter to use a more accurate starting block height for monitoring anchor transaction confirmations, particularly crucial for scenarios like remote-initiated force closes where a node might have been offline. The change specifically leverages lnd's commitment transaction block height information to prevent issues where transfer proofs might not be imported due to transactions confirming before the node caught up. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a HeightHint to asset transfer parcels to address a bug where nodes with a Neutrino backend could fail to import transfer proofs for remote-initiated force closes. The changes are well-structured and directly solve the described issue by allowing the chain porter to use a specific block height for transaction confirmation, rather than relying on the current block height. My feedback is mainly focused on updating function comments to reflect the new parameters, ensuring the codebase remains well-documented and easy to understand.
Pull Request Test Coverage Report for Build 20354280750Details
💛 - Coveralls |
c903424 to
6c45c21
Compare
Adds a HeightHint() method to the Parcel interface that allows a parcel to include an optional block height hint for its corresponding anchor transaction's confirmation if this information is available, e.g. via the 'CommitTxBlockHeight' supplied by lnd.
Have they attempted to reset the height hint cache on their |
Having taken a look at this, it seems that lnd will use the incorrect hint from tapd regardless: (lnd/chainntnfs/txnotifier.go L645) |
6c45c21 to
66062d5
Compare
Checks if the parcel provides a height hint, and uses that if present, falling back to the current height if nothing is available.
Also touches up some lines that had trailing whitespace.
Should resolve #1848, at least future instances of such. More detail below.
Adds a HeightHint() method to the Parcel interface that allows a parcel to include an optional block height hint for its corresponding anchor transaction's confirmation, if this information is available (e.g. via the 'CommitTxBlockHeight' supplied by lnd).
If a parcel contains a height hint, then we use that in the chain porter's SendStateStorePreBroadcast state, falling back to the current block height otherwise. This is expected to resolve the issue described in #1848, in which assets were never found on-chain after a remote-initiated force close in a very particular environment.
My working hypothesis regarding the linked issue is that the node, which appears to have been running with a Neutrino backend, was offline when the force close occurred, catching up only after the force close transaction had been confirmed. (In the logs supplied with that issue, one can see that immediately prior to and after the 'Unilateral close of ChannelPoint..' entry, blocks are being received at a rate of about one per second.)
In this situation, the force close transaction appears to have proceeded through the chain porter's state machine normally, eventually reaching the SendStateStorePreBroadcast state, where its transfer parcel was augmented with a hint of the current block height for its anchor transaction. It then entered the SendStateWaitTxConf state with that hint, and, since the node's chain backend didn't support txindex, waited for transaction confirmation from that block forward. Since the force close had confirmed prior to that block, the parcel just became stuck in that state, never proceeding to a later state in which the transfer proofs would have been persisted to the local proof archive.
When the sweep transaction parcels proceeded through the porter's state machine, they thus hit an error during the SendStateStorePostAnchorTxConf state, since the proofs for the requisite force close transaction couldn't be found.
The fix here, which applies specifically to the remote-initiated force close case, uses the 'CommitTxBlockHeight' information that lnd supplies to 'importCommitTx' as a height hint if it's available, which is the height of the actual block that included the commitment transaction. This should fix future instances of this issue, but doesn't mitigate existing stuck force-close parcels.