Skip to content

Commit

Permalink
add whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
area363 committed Oct 25, 2023
1 parent fdae923 commit 76454a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Lib9c.Policy/AccessControlService/IAccessControlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ namespace Nekoyume.Blockchain
public interface IAccessControlService
{
public bool IsAccessDenied(Address address);

public int GetAccessLevel(Address address);
}
}
9 changes: 7 additions & 2 deletions Lib9c.Policy/NCStagePolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ public IEnumerable<Transaction> Iterate(BlockChain blockChain, bool filtered = t
s.Add(tx);
if (s.Count > _quotaPerSigner)
{
s.Remove(s.Max);
var accessLevel = _accessControlService?.GetAccessLevel(tx.Signer);
if (accessLevel <= 0)
{
s.Remove(s.Max);
}
}
}

Expand All @@ -77,7 +81,8 @@ public IEnumerable<Transaction> Iterate(BlockChain blockChain, bool filtered = t

public bool Stage(BlockChain blockChain, Transaction transaction)
{
if (_accessControlService != null && _accessControlService.IsAccessDenied(transaction.Signer))
var accessLevel = _accessControlService?.GetAccessLevel(transaction.Signer);
if (accessLevel == 0)
{
return false;
}
Expand Down

0 comments on commit 76454a6

Please sign in to comment.