Permalink
Browse files

Extend DoS functionality

  • Loading branch information...
nopara73 committed Nov 2, 2018
1 parent 8d538e4 commit 52621a6798e39ec6113b5ec62d4d0b9eaccadbda
Showing with 11 additions and 3 deletions.
  1. +1 −1 WalletWasabi/Services/CcjCoordinator.cs
  2. +10 −2 WalletWasabi/Services/UtxoReferee.cs
@@ -54,7 +54,7 @@ public CcjCoordinator(Network network, string folderPath, RPCClient rpc, CcjRoun
Directory.CreateDirectory(FolderPath);
UtxoReferee = new UtxoReferee(Network, FolderPath, RpcClient);
UtxoReferee = new UtxoReferee(Network, FolderPath, RpcClient, RoundConfig);
// Initialize RsaKey
string rsaKeyPath = Path.Combine(FolderPath, "RsaKey.json");
@@ -9,6 +9,7 @@
using System.Threading.Tasks;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
using WalletWasabi.Models.ChaumianCoinJoin;
namespace WalletWasabi.Services
{
@@ -22,16 +23,18 @@ public class UtxoReferee
public string BannedUtxosFilePath => Path.Combine(FolderPath, $"BannedUtxos{Network}.txt");
public RPCClient RpcClient { get; }
public Network Network { get; }
public CcjRoundConfig RoundConfig { get; }
public string FolderPath { get; }
public UtxoReferee(Network network, string folderPath, RPCClient rpc)
public UtxoReferee(Network network, string folderPath, RPCClient rpc, CcjRoundConfig roundConfig)
{
Network = Guard.NotNull(nameof(network), network);
FolderPath = Guard.NotNullOrEmptyOrWhitespace(nameof(folderPath), folderPath, trim: true);
RpcClient = Guard.NotNull(nameof(rpc), rpc);
RoundConfig = Guard.NotNull(nameof(roundConfig), roundConfig);
BannedUtxos = new ConcurrentDictionary<OutPoint, (int severity, DateTimeOffset timeOfBan)>();
@@ -85,6 +88,11 @@ public UtxoReferee(Network network, string folderPath, RPCClient rpc)
public async Task BanUtxosAsync(int severity, DateTimeOffset timeOfBan, params OutPoint[] toBan)
{
if (RoundConfig.DosSeverity == 0)
{
return;
}
var lines = new List<string>();
foreach (var utxo in toBan)
{

0 comments on commit 52621a6

Please sign in to comment.