Skip to content

Commit

Permalink
fix(net): reset block demand when not changed
Browse files Browse the repository at this point in the history
[changelog skip]
  • Loading branch information
moreal committed Jan 22, 2021
1 parent b5fdad9 commit 5d70c66
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Libplanet/Net/Swarm.cs
Expand Up @@ -1715,8 +1715,9 @@ CancellationToken cancellationToken
continue;
}

BoundPeer peer = BlockDemand.Value.Peer;
var hash = new HashDigest<SHA256>(BlockDemand.Value.Header.Hash.ToArray());
BlockDemand blockDemand = BlockDemand.Value;
BoundPeer peer = blockDemand.Peer;
var hash = new HashDigest<SHA256>(blockDemand.Header.Hash.ToArray());

try
{
Expand Down Expand Up @@ -1760,7 +1761,10 @@ CancellationToken cancellationToken
// from the beginning of this operation.
_logger.Debug($"{nameof(ProcessFillBlocks)}() finished. " +
$"Reset {nameof(BlockDemand)}...");
BlockDemand = null;
if (BlockDemand.Equals(blockDemand))
{
BlockDemand = null;
}
}
}
}
Expand Down

0 comments on commit 5d70c66

Please sign in to comment.