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

[feature]: detect external spend of co-owned asset #1401

Open
guggero opened this issue Feb 19, 2025 · 0 comments
Open

[feature]: detect external spend of co-owned asset #1401

guggero opened this issue Feb 19, 2025 · 0 comments
Labels
assets chain enhancement New feature or request

Comments

@guggero
Copy link
Member

guggero commented Feb 19, 2025

This is mostly relevant for multi signature assets, where either the BTC-level or asset-level key are multi signature or special scripting conditions.

Today, we only mark an asset as spent when we create a transfer to spend it locally.
But in a scenario where we have a co-owned asset (e.g. multi signature) in our database but the other party spends it, we don't ever set our asset to spent, even though we could easily detect the spend of the on-chain UTXO.
Example cases:

  • The asset channel funding transaction is imported into both parties' databases. But only one party will create a transfer spending it (either a force close or cooperative close transaction), on the other side it might remain as showing unspent
  • MuSig2 asset swaps: Funds are deposited into a muSig2 deposit output. Depending on who spends it, the other party might not detect the spend

Steps to completion:

  • Choose an appropriate component to add this functionality to (perhaps the tapgarden.Custodian? Or a new component?)
  • On component startup, list all currently unspent assets and extract their anchor transaction
  • Register spend notifications for those transactions. On spend, update the asset table (check transfers first, see below).
  • Allow other components to register new assets to watch for (e.g. the freighter or on manual proof import)
  • Make sure this component doesn't interfere with the asset store's logic that is called by the freighter, otherwise new assets might not be created correctly
    • When attempting to update an asset to spent in the database, first make sure there isn't a pending transfer that attempts to spend that asset. If there is, don't do anything and let the freighter do the update.
@guggero guggero added assets chain enhancement New feature or request labels Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assets chain enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant