Skip to content

Commit

Permalink
fix deposit pre validation for non persisted account. (#795)
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelPawelec-RDX authored Oct 3, 2024
1 parent 5110270 commit 1a1134f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Release built: _not released yet_

### Bug fixes
- Added missing `total_count` property to `/state/validators/list` response.
- Fix `/transaction/account-deposit-pre-validation` for uninstantiated pre-allocated accounts. It no longer returns error with code 404 `Entity not found`.

### API Changes
- Restored previously removed `total_count` property to `/state/key-value-store/keys` endpoint.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,25 @@ public DepositPreValidationQuerier(
CancellationToken token = default
)
{
var accountEntity = await _entityQuerier.GetNonVirtualEntity<GlobalAccountEntity>(_dbContext, accountAddress, ledgerState, token);
var xrdResourceAddress = (await _networkConfigurationProvider.GetNetworkConfiguration(token)).WellKnownAddresses.Xrd;
var accountEntity = await _entityQuerier.GetEntity<GlobalAccountEntity>(accountAddress, ledgerState, token);
if (accountEntity is VirtualAccountComponentEntity)
{
var resourceItems = resourceAddresses
.Select(
resourceAddress => new GatewayModel.AccountDepositPreValidationDecidingFactorsResourceSpecificDetailsItem(
resourceAddress,
false,
resourceAddress == xrdResourceAddress))
.ToList();

return new GatewayModel.AccountDepositPreValidationDecidingFactors(
badgeResourceAddress.HasValue ? false : null,
AccountDefaultDepositRule.Accept.ToGatewayModel(),
resourceItems
);
}

var addressesToResolve = resourceAddresses.ToList();
if (badgeResourceAddress.HasValue)
{
Expand Down

0 comments on commit 1a1134f

Please sign in to comment.