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

refactor: consolidate ProTx wallet UTXO locking logic #6536

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

kwvg
Copy link
Collaborator

@kwvg kwvg commented Jan 23, 2025

Additional Information

  • This pull request consolidates locking ProTx UTXOs in a wallet by splitting them into three steps

    • Scanning transactions for eligible UTXOs and registering them in the wallet UTXO set (AddWalletUTXOs())
    • Going through a UTXO set and finding ProTx transactions (modified ListProTxCoins() to accept supplied sets)
    • Locking all supplied ProTx UTXOs (folded into LockProTxCoins(), which utilizes the previous two steps)
  • These are the behavior changes expected from this PR:

    • AutoLockMasternodeCollaterals() will now add new UTXOs it finds to the wallet UTXO set (setWalletUTXO) (earlier behavior was to only scan and lock).
    • UTXO locks will be consistently stored on disk (persistent locks were introduced in bitcoin#23065 (dash#6530) but weren't consistently used in all applicable LockCoin() calls)
  • The m_chain checks removed from various sections are acceptable as the check is still present in ListProTxCoins() (source) and it will clear the vector if it fails, which will effectively skip subsequent logic (also because it's the only place where listMNCollaterials is called)

    • Though this does not prevent them from being added to the wallet UTXO set as this happens before ListProTxCoins() is called but this isn't undesirable.

Breaking Changes

None expected.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@kwvg kwvg added this to the 22.1 milestone Jan 23, 2025
@kwvg kwvg requested a review from knst January 23, 2025 15:51
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.

1 participant