public override void ResolveCollision(UTXOIndex tablePrimary) { KeyValuePair <byte[], uint[]> collisionItem = CollisionTable.First(k => BitConverter.ToInt32(k.Key, 0) == tablePrimary.PrimaryKey); CollisionTable.Remove(collisionItem.Key); if (!tablePrimary.AreCollisionBitsFull() || !HasCountCollisions(tablePrimary.PrimaryKey, COUNT_COLLISIONS_MAX)) { tablePrimary.DecrementCollisionBits(Address); } collisionItem.Value[0] |= tablePrimary.GetCollisionBits(); PrimaryTable.Add(tablePrimary.PrimaryKey, collisionItem.Value); }
void LoadPrimaryData(byte[] buffer) { int index = 0; int key; int uintLength; uint[] value; while (index < buffer.Length) { key = BitConverter.ToInt32(buffer, index); index += 4; int byteLength = VarInt.GetInt32(buffer, ref index); uintLength = byteLength >> 2; value = new uint[uintLength]; Buffer.BlockCopy(buffer, index, value, 0, byteLength); index += byteLength; PrimaryTable.Add(key, value); } }
public override void AddUTXOAsPrimary(int primaryKey) { PrimaryTable.Add(primaryKey, UTXO); }