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

Add address to GetAvailableUtxos in NodeguardService #377

Merged
merged 9 commits into from
Jul 1, 2024

Conversation

RodriFS
Copy link
Contributor

@RodriFS RodriFS commented Jun 26, 2024

No description provided.

@RodriFS RodriFS changed the base branch from main to utxo-freezing-data-model June 26, 2024 08:57
@RodriFS RodriFS force-pushed the add-address-to-utxo-in-nodeguard-service branch from 8fed50f to db25290 Compare June 26, 2024 10:03
Copy link
Contributor

@markettes markettes left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@daliclovr daliclovr left a comment

Choose a reason for hiding this comment

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

@RodriFS can you explain to me what is considered an AvailableUTXO? I imagine that is something like "your utxo is not spent but is being used (i,e lightning channel)". Are unavailablesUTXO marked as locked? how are they marked?

@RodriFS
Copy link
Contributor Author

RodriFS commented Jun 27, 2024

@RodriFS can you explain to me what is considered an AvailableUTXO? I imagine that is something like "your utxo is not spent but is being used (i,e lightning channel)". Are unavailablesUTXO marked as locked? how are they marked?

That's exactly right. Avaliable utxos are locked in a request or frozen.
There is a different on how we manage locked and frozen utxos:

  • the locked utxos are not marked, each time you request the list of available utxos, we go and check if there is a request that is taking hold of that utxos and we don't add those to the list
  • the frozen utxos are marked with a flag in the database

You can see the implementation here:

public async Task<List<FMUTXO>> GetLockedUTXOs(int? ignoredWalletWithdrawalRequestId = null, int? ignoredChannelOperationRequestId = null)

@RodriFS RodriFS requested a review from daliclovr June 27, 2024 09:11
src/Rpc/NodeGuardService.cs Outdated Show resolved Hide resolved
src/Rpc/NodeGuardService.cs Outdated Show resolved Hide resolved
@daliclovr
Copy link
Contributor

daliclovr commented Jun 27, 2024

@RodriFS can you explain to me what is considered an AvailableUTXO? I imagine that is something like "your utxo is not spent but is being used (i,e lightning channel)". Are unavailablesUTXO marked as locked? how are they marked?

That's exactly right. Avaliable utxos are locked in a request or frozen. There is a different on how we manage locked and frozen utxos:

  • the locked utxos are not marked, each time you request the list of available utxos, we go and check if there is a request that is taking hold of that utxos and we don't add those to the list
  • the frozen utxos are marked with a flag in the database

You can see the implementation here:

public async Task<List<FMUTXO>> GetLockedUTXOs(int? ignoredWalletWithdrawalRequestId = null, int? ignoredChannelOperationRequestId = null)

@RodriFS I feel that what you clarify to me today, the difference between locked and frozen should be reflected somewhere. Both status means the same in the sense of utxos are not usable if locked or frozen, although frozen is a "permanent" status and locked is a computed status based on others. Is quite confusing if this information is not added anywhere...

@RodriFS
Copy link
Contributor Author

RodriFS commented Jun 28, 2024

@RodriFS can you explain to me what is considered an AvailableUTXO? I imagine that is something like "your utxo is not spent but is being used (i,e lightning channel)". Are unavailablesUTXO marked as locked? how are they marked?

That's exactly right. Avaliable utxos are locked in a request or frozen. There is a different on how we manage locked and frozen utxos:

  • the locked utxos are not marked, each time you request the list of available utxos, we go and check if there is a request that is taking hold of that utxos and we don't add those to the list
  • the frozen utxos are marked with a flag in the database

You can see the implementation here:

public async Task<List<FMUTXO>> GetLockedUTXOs(int? ignoredWalletWithdrawalRequestId = null, int? ignoredChannelOperationRequestId = null)

@RodriFS I feel that what you clarify to me today, the difference between locked and frozen should be reflected somewhere. Both status means the same in the sense of utxos are not usable if locked or frozen, although frozen is a "permanent" status and locked is a computed status based on others. Is quite confusing if this information is not added anywhere...

@daliclovr please review the PR again. We removed the IsFrozen flag on the utxos, and now we just use the tags to know the status of a utxo. So we don't have to register utxos in the table at all, we just tag utxos comming from the nbxplorer

@RodriFS RodriFS requested a review from daliclovr June 28, 2024 09:05
markettes
markettes previously approved these changes Jun 28, 2024
src/Rpc/NodeGuardService.cs Outdated Show resolved Hide resolved
src/Proto/nodeguard.proto Outdated Show resolved Hide resolved
src/Proto/nodeguard.proto Outdated Show resolved Hide resolved
Base automatically changed from utxo-freezing-data-model to main July 1, 2024 11:26
@RodriFS RodriFS dismissed markettes’s stale review July 1, 2024 11:26

The base branch was changed.

Jossec101
Jossec101 previously approved these changes Jul 1, 2024
@RodriFS RodriFS force-pushed the add-address-to-utxo-in-nodeguard-service branch from db235f1 to 2a8498b Compare July 1, 2024 14:33
@daliclovr
Copy link
Contributor

@RodriFS can you explain to me what is considered an AvailableUTXO? I imagine that is something like "your utxo is not spent but is being used (i,e lightning channel)". Are unavailablesUTXO marked as locked? how are they marked?

That's exactly right. Avaliable utxos are locked in a request or frozen. There is a different on how we manage locked and frozen utxos:

  • the locked utxos are not marked, each time you request the list of available utxos, we go and check if there is a request that is taking hold of that utxos and we don't add those to the list
  • the frozen utxos are marked with a flag in the database

You can see the implementation here:

public async Task<List<FMUTXO>> GetLockedUTXOs(int? ignoredWalletWithdrawalRequestId = null, int? ignoredChannelOperationRequestId = null)

@RodriFS I feel that what you clarify to me today, the difference between locked and frozen should be reflected somewhere. Both status means the same in the sense of utxos are not usable if locked or frozen, although frozen is a "permanent" status and locked is a computed status based on others. Is quite confusing if this information is not added anywhere...

@daliclovr please review the PR again. We removed the IsFrozen flag on the utxos, and now we just use the tags to know the status of a utxo. So we don't have to register utxos in the table at all, we just tag utxos comming from the nbxplorer

@RodriFS how can you tag the utxos in advance without knowing the score? What is the status to consider them locked now?

@RodriFS RodriFS merged commit 0e442d3 into main Jul 1, 2024
4 checks passed
@RodriFS RodriFS deleted the add-address-to-utxo-in-nodeguard-service branch July 1, 2024 15:33
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.

4 participants