void MergePendingHeaders()
{
mBlockLock.WaitOne();
if (mBlocks.Count > 0)
{
for (int i = mBlocks.Count - 1; i >= 0; i--)
{
if (Utils.HashCompare(mBlocks[i].mHeader.mHash, mPendingHeaders[0].mPrevBlock))
{
if (i < (mBlocks.Count - 1))
{
Console.WriteLine("Stop here and figure out how to handle this case!!!");
}
else
{
foreach (BlockHeader h in mPendingHeaders)
{
Block b = new Block();
b.mHeader = h;
mBlocks.Add(b);
b.mHeight = mCurrentHeight++;
}
}
}
}
}
else
{
// No blocks yet, just dump all these into the block list
foreach (BlockHeader h in mPendingHeaders)
{
Block b = new Block();
b.mHeader = h;
mBlocks.Add(b);
b.mHeight = mCurrentHeight++;
}
}
mBlockLock.ReleaseMutex();
}