Skip to content

Commit

Permalink
Pass headers by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Coding-Enthusiast committed Jul 29, 2024
1 parent 5d99eb9 commit c142ca5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Src/Autarkysoft.Bitcoin/Blockchain/Chain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private void ResetBlockInfo()


/// <inheritdoc/>
public Target GetNextTarget(BlockHeader first, BlockHeader last)
public Target GetNextTarget(in BlockHeader first, in BlockHeader last)
{
uint timeDiff = last.BlockTime - first.BlockTime;
if (timeDiff < Constants.PowTargetTimespan / 4)
Expand Down Expand Up @@ -529,7 +529,7 @@ private long GetMedianTimePast(int startIndex)
return times[times.Count / 2];
}

private bool ProcessHeader(BlockHeader header, BlockHeader prvHeader, int height, Target nextTarget)
private bool ProcessHeader(in BlockHeader header, in BlockHeader prvHeader, int height, Target nextTarget)
{
Consensus.BlockHeight = height;
return header.PreviousBlockHeaderHash.Equals(prvHeader.Hash) &&
Expand Down

0 comments on commit c142ca5

Please sign in to comment.