Skip to content

Commit

Permalink
Remove root hash validation from upload command
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Nov 19, 2024
1 parent e6482d8 commit 4be9637
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
8 changes: 0 additions & 8 deletions src/EthernaGatewayCli/Commands/Etherna/Chunk/UploadCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@ protected override async Task ExecuteAsync(string[] commandArgs)
}
var batchDepth = postageBuckets.RequiredPostageBatchDepth;

// Check root hash if present.
if (Options.RootHash.HasValue)
{
var rootHashStr = Options.RootHash.ToString();
if (chunkFiles.All(cf => Path.GetFileNameWithoutExtension(cf) != rootHashStr))
throw new InvalidOperationException("Root hash is not present in chunk files");
}

// Identify postage batch and tag to use.
var batchId = await postageBatchService.GetUsablePostageBatchAsync(
batchDepth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public class UploadCommandOptions : CommandOptionsBase
new(null, "--postage", "Use an existing postage batch. Create a new otherwise", args => UsePostageBatchId = args[0], [typeof(string)]),
new("-A", "--auto-purchase", "Auto purchase new postage batch", _ => NewPostageAutoPurchase = true),
new("-l", "--label", "Label of new postage batch", args => NewPostageLabel = args[0], [typeof(string)]),
new("-t", "--ttl", $"TTL (days) of new postage batch (default: {DefaultPostageBatchTtl.Days} days)", args => NewPostageTtl = TimeSpan.FromDays(int.Parse(args[0])), [typeof(int)]),
new("-r", "--root-hash", "Specify resource root hash", args => RootHash = new SwarmHash(args[0]), [typeof(string)])
new("-t", "--ttl", $"TTL (days) of new postage batch (default: {DefaultPostageBatchTtl.Days} days)", args => NewPostageTtl = TimeSpan.FromDays(int.Parse(args[0])), [typeof(int)])
];
public override IEnumerable<OptionRequirementBase> Requirements =>
[
Expand All @@ -43,7 +42,6 @@ public class UploadCommandOptions : CommandOptionsBase
public bool NewPostageAutoPurchase { get; private set; }
public string? NewPostageLabel { get; private set; }
public TimeSpan NewPostageTtl { get; private set; } = DefaultPostageBatchTtl;
public SwarmHash? RootHash { get; private set; }
public string? UsePostageBatchId { get; private set; }
}
}

0 comments on commit 4be9637

Please sign in to comment.