Exemplo n.º 1
0
        public bool AddKey(Guid chainId, PublicKey key, PrivateKey?privateKey)
        {
            var slotIndex = (int)(key.GetPosition() % _slots[chainId].Length);
            var slot      = _slots[chainId][slotIndex];

            if (slot.PublicKey is PublicKey slotKey
                )// && slotKey.GetDifficulty(chainId, slot.Salt) > key.GetDifficulty(chainId, slot.Salt))
            {
                return(false);
            }

            slot.PublicKey  = key;
            slot.PrivateKey = privateKey;

            slot.Occupant = _createNode.Invoke(chainId, slotIndex, slot.PublicKey.Value, slot.PrivateKey);

            return(true);
        }