Skip to content

Commit

Permalink
Removed unnecessary parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
greymistcube committed Sep 4, 2024
1 parent ac8f1fb commit 8cfdc97
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
3 changes: 0 additions & 3 deletions src/Libplanet.Net/Swarm.BlockCandidate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ private async Task<bool> ProcessBlockDemandAsync(
var result = await BlockCandidateDownload(
peer: peer,
blockChain: BlockChain,
stop: demand.BlockExcerpt,
logSessionId: sessionId,
cancellationToken: cancellationToken);

Expand Down Expand Up @@ -423,7 +422,6 @@ private async Task<bool> ProcessBlockDemandAsync(
private async Task<bool> BlockCandidateDownload(
BoundPeer peer,
BlockChain blockChain,
IBlockExcerpt stop,
int logSessionId,
CancellationToken cancellationToken)
{
Expand All @@ -433,7 +431,6 @@ private async Task<bool> BlockCandidateDownload(
List<BlockHash> hashes = await GetBlockHashes(
peer: peer,
locator: locator,
timeout: null,
cancellationToken: cancellationToken);

if (!hashes.Any())
Expand Down
8 changes: 1 addition & 7 deletions src/Libplanet.Net/Swarm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -739,15 +739,10 @@ public Task AddPeersAsync(
internal async Task<List<BlockHash>> GetBlockHashes(
BoundPeer peer,
BlockLocator locator,
TimeSpan? timeout = null,
CancellationToken cancellationToken = default)
{
var request = new GetBlockHashesMsg(locator);

TimeSpan transportTimeout = timeout is { } t
&& t > Options.TimeoutOptions.GetBlockHashesTimeout
? t
: Options.TimeoutOptions.GetBlockHashesTimeout;
const string sendMsg =
"Sending a {MessageType} message with locator [{LocatorHead}]";
_logger.Debug(
Expand All @@ -761,7 +756,7 @@ internal async Task<List<BlockHash>> GetBlockHashes(
parsedMessage = await Transport.SendMessageAsync(
peer,
request,
timeout: transportTimeout,
timeout: Options.TimeoutOptions.GetBlockHashesTimeout,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
catch (CommunicationFailException)
Expand Down Expand Up @@ -1087,7 +1082,6 @@ internal async Task<List<BlockHash>> GetDemandBlockHashesFromPeer(
List<BlockHash> blockHashes = await GetBlockHashes(
peer: peer,
locator: locator,
timeout: null,
cancellationToken: cancellationToken);

foreach (var blockHash in blockHashes)
Expand Down
3 changes: 1 addition & 2 deletions test/Libplanet.Net.Tests/SwarmTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,7 @@ public async Task GetMultipleBlocksAtOnce()

List<BlockHash> hashes = await swarmB.GetBlockHashes(
peer,
new BlockLocator(genesis.Hash),
null);
new BlockLocator(genesis.Hash));

ITransport transport = swarmB.Transport;

Expand Down

0 comments on commit 8cfdc97

Please sign in to comment.