Skip to content

Conversation

@febo
Copy link
Contributor

@febo febo commented Dec 2, 2025

Problem

As noted in this comment, the amount is not decremented when executing a self-unwrap.

Solution

Update the implementation to allow a self-unwrap to decrement the amount of the account. The lamports of the account remain unchanged as expected.

Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks great! Just the one comment which you can take or leave

// Comparing whether the AccountInfo's "point" to the same account or
// not - this is a faster comparison since it just checks the internal
// raw pointer.
if source_account_info != destination_account_info {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it help CUs to tag this with likely?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, I tried that as well but the compiler is already doing the right thing.

@febo febo merged commit 90b8f5c into main Dec 2, 2025
17 checks passed
@febo febo deleted the febo/self-unwrap branch December 2, 2025 12:22
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