Repository navigation
Data model for freezing UTXOs #376
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
Merged
Merged
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
3f0e06d
feat: add address, isFrozen and tag
markettes 53e49ac
feat: filter frozen utxos
markettes 74df0da
feat: utxo migration
markettes 5ddea6d
feat: add postgres for nbxplorer
markettes c7f246d
fix: add migration for optional address and tag
markettes 0feff81
feat: RegisterUTXOs job
markettes 6f156ee
feat: add wallet to FMUTXO
markettes a87309f
feat(FMUTXO.cs): add IsSpent property to determine if UTXO is spent b…
markettes bdc206b
feat(FMUTXO.cs): add NBitcoin and NBXplorer dependencies for UTXO mod…
markettes 5cc7705
feat: consolidate migrations
markettes 728e024
fix: migration
markettes 78920cf
refactor(ChannelOperationRequestRepositoryTests): add additional null…
markettes bd5dca9
Bump deps
Jossec101 b4ed8a4
Fix problem with new change in nbxplorer when tracking btc addresses
Jossec101 48196b5
feat: rebuild of the migration
markettes 456200c
Merge branch 'update-deps' into utxo-freezing-data-model
markettes f8240e5
Merge branch 'main' into utxo-freezing-data-model
markettes 190554c
EF Core already does execute the migration in a transaction scope, th…
Jossec101 b636c9e
feat: changes for deps update
markettes 55a381e
Fix AddRangeAsync not using a generic function type making EF Core fa…
Jossec101 ba242c6
Fix RegisterUTXOsJob to use WalletId instead of Wallet property
Jossec101 bc80a8d
Merge branch 'main' into utxo-freezing-data-model
markettes 2f95e5f
fix: rollback changes
markettes 1efb82a
feat(FMUTXO.cs): add Blazorise.Extensions for enhanced functionality
markettes 1ebcf1a
fix: remove error and set the creation time and the update time
markettes 3b8efdd
refactor(FUTXORepository.cs): optimize UTXO retrieval logic to enhanc…
markettes 711fcd2
fix: rollback the port
markettes 19faae7
fix: remove isSpent
markettes c7cad38
refactor(FUTXORepository): replace GetFromUTXOs with GetByOutpoint fo…
markettes db218ec
fix(docker-compose.yml): change PostgreSQL service port mapping to av…
markettes 1d4690d
fix: fix method type
markettes 7e79ce6
fix: remove unused imports
markettes 50ce070
fix: comments
markettes c0bee08
feat: UTXOTag in another file
markettes ca965cd
fix: set to dbtrie again
markettes 79573e5
feat: explanation of the job
markettes f510933
Update src/Services/CoinSelectionService.cs
markettes 32b7cb9
Update src/Services/CoinSelectionService.cs
markettes 89df184
feat(RegisterUTXOsJob.cs): skip processing wallets without derivation…
markettes b51cd1a
fix: tags in the relations
markettes 98236b4
fix: add throw
markettes 69c1acf
chore: comments
markettes a38f089
refactor: remove job to add utxos
markettes f3a9a46
refactor: remove properties to rollback changes
markettes a69cf2d
refactor: remove unused methods
markettes 78a5851
chore(FMUTXO.cs): remove unused using directives to clean up code
markettes 8164d37
style(FUTXORepository.cs): remove extra whitespace for cleaner code f…
markettes 8cc2a1b
refactor(Constants.cs): remove REGISTER_UTXOS_CRON constant and its e…
markettes bd6fd5d
style(FMUTXO.cs): remove extra whitespace for cleaner code formatting
markettes 1dd3fa2
refactor(FMUTXO.cs): remove unused NBitcoin and NBXplorer imports to …
markettes 54cd988
refactor: remove logic for FMUTXOs
markettes 34565cb
refactor: remove spaces
markettes 3592a36
refactor: rollback logic changes
markettes 9a11cda
style(CoinSelectionService.cs): add missing line break for better cod…
markettes d7294ec
refactor: remove migration
markettes 218f52e
feat: utxotag repository
markettes 39ef3d4
refactor(UTXOTag.cs): remove FMUTXO navigation properties to decouple…
markettes 51a664a
feat(IUTXOTagRepository, UTXOTagRepository): add GetTagByKeyAndOutpoi…
markettes eb8f9f7
style(UTXOTagRepository.cs): fix indentation for better code readability
markettes 1ff1f20
refactor(UTXOTag): make Outpoint property non-nullable to enforce dat…
markettes b61e449
feat: exclude frozen utxos
markettes a81730f
fix: add repository
markettes a27b906
feat: migration
markettes 063f64d
refactor(NodeGuardServiceTests.cs): add missing null parameter to con…
markettes e9d7315
feat: add unique constraint for key outpoint in the utxotag table
markettes 8fb6d7c
test: fix tests and add one more
markettes 750f09a
Update src/Helpers/Constants.cs
RodriFS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| namespace NodeGuard.Data.Models; | ||
|
|
||
| public class UTXOTag : Entity | ||
| { | ||
| public string Key { get; set; } | ||
|
|
||
| public string Value { get; set; } | ||
|
|
||
| // Outpoint of the UTXO in format "hash-index" | ||
| public string Outpoint { get; set; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| using NodeGuard.Data.Models; | ||
|
|
||
| namespace NodeGuard.Data.Repositories.Interfaces; | ||
|
|
||
| public interface IUTXOTagRepository | ||
| { | ||
| Task<UTXOTag?> GetByOutpoint(string outpoint); | ||
|
|
||
| Task<UTXOTag?> GetByKeyAndOutpoint(string key, string outpoint); | ||
|
|
||
| Task<List<UTXOTag>> GetByKeyValue(string key, string value); | ||
|
|
||
| Task<(bool, string?)> AddAsync(UTXOTag type); | ||
|
|
||
| Task<(bool, string?)> AddRangeAsync(List<UTXOTag> type); | ||
|
|
||
| (bool, string?) Remove(UTXOTag type); | ||
|
|
||
| (bool, string?) RemoveRange(List<UTXOTag> types); | ||
|
|
||
| (bool, string?) Update(UTXOTag type); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| using Microsoft.EntityFrameworkCore; | ||
| using NodeGuard.Data.Models; | ||
| using NodeGuard.Data.Repositories.Interfaces; | ||
|
|
||
| namespace NodeGuard.Data.Repositories; | ||
|
|
||
| public class UTXOTagRepository : IUTXOTagRepository | ||
| { | ||
| private readonly IRepository<UTXOTag> _repository; | ||
| private readonly ILogger<UTXOTagRepository> _logger; | ||
| private readonly IDbContextFactory<ApplicationDbContext> _dbContextFactory; | ||
|
|
||
| public UTXOTagRepository(IRepository<UTXOTag> repository, | ||
| ILogger<UTXOTagRepository> logger, | ||
| IDbContextFactory<ApplicationDbContext> dbContextFactory) | ||
| { | ||
| _repository = repository; | ||
| _logger = logger; | ||
| _dbContextFactory = dbContextFactory; | ||
| } | ||
|
|
||
| public async Task<UTXOTag?> GetByOutpoint(string outpoint) | ||
| { | ||
| await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); | ||
|
|
||
| return await applicationDbContext.UTXOTags.FirstOrDefaultAsync(x => x.Outpoint == outpoint); | ||
| } | ||
|
|
||
| public async Task<UTXOTag?> GetByKeyAndOutpoint(string key, string outpoint) | ||
| { | ||
| await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); | ||
|
|
||
| return await applicationDbContext.UTXOTags.FirstOrDefaultAsync(x => x.Key == key && x.Outpoint == outpoint); | ||
| } | ||
|
|
||
| public async Task<List<UTXOTag>> GetByKeyValue(string key, string value) | ||
| { | ||
| await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); | ||
|
|
||
| return await applicationDbContext.UTXOTags | ||
| .Where(x => x.Key == key && x.Value == value).ToListAsync(); | ||
| } | ||
|
|
||
| public async Task<(bool, string?)> AddAsync(UTXOTag type) | ||
| { | ||
| await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); | ||
|
|
||
| type.SetCreationDatetime(); | ||
|
|
||
| return await _repository.AddAsync(type, applicationDbContext); | ||
| } | ||
|
|
||
| public async Task<(bool, string?)> AddRangeAsync(List<UTXOTag> type) | ||
| { | ||
| await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); | ||
|
|
||
| return await _repository.AddRangeAsync(type, applicationDbContext); | ||
| } | ||
|
|
||
| public (bool, string?) Remove(UTXOTag type) | ||
| { | ||
| using var applicationDbContext = _dbContextFactory.CreateDbContext(); | ||
|
|
||
| return _repository.Remove(type, applicationDbContext); | ||
| } | ||
|
|
||
| public (bool, string?) RemoveRange(List<UTXOTag> types) | ||
| { | ||
| using var applicationDbContext = _dbContextFactory.CreateDbContext(); | ||
|
|
||
| return _repository.RemoveRange(types, applicationDbContext); | ||
| } | ||
|
|
||
| public (bool, string?) Update(UTXOTag type) | ||
| { | ||
| using var applicationDbContext = _dbContextFactory.CreateDbContext(); | ||
|
|
||
| type.SetUpdateDatetime(); | ||
|
|
||
| return _repository.Update(type, applicationDbContext); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.