Ejemplo n.º 1
0
        protected void InvalidateBitcoinHashes(object sender, EventArgs e)
        {
            ContractsCommon.NotFrozen(this);

            _hash256 = null;
            _hash160 = null;
            if (HashesInvalidated != null)
            {
                HashesInvalidated(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 2
0
        public static bool TryParse(string hashString, out Hash160 hash)
        {
            Contract.Ensures(Contract.Result <bool>() == true || Contract.ValueAtReturn(out hash) == default(Hash160));
            Contract.Ensures(Contract.Result <bool>() == false || Contract.ValueAtReturn(out hash) != null);

            try
            {
                hash = Parse(hashString);
                return(true);
            }
            catch (ArgumentException) { }
            catch (FormatException) { }
            catch (OverflowException) { }

            hash = default(Hash160);
            return(false);
        }
Ejemplo n.º 3
0
        public static bool TryParse(string hashString, out Hash160 hash)
        {
            Contract.Ensures(Contract.Result<bool>() == true || Contract.ValueAtReturn(out hash) == default(Hash160));
            Contract.Ensures(Contract.Result<bool>() == false || Contract.ValueAtReturn(out hash) != null);

            try
            {
                hash = Parse(hashString);
                return true;
            }
            catch (ArgumentException) { }
            catch (FormatException) { }
            catch (OverflowException) { }

            hash = default(Hash160);
            return false;
        }
Ejemplo n.º 4
0
 public static void AssertThatHashMatches(BitcoinObject bitObj, Hash160 expectedHash)
 {
     Assert.AreEqual(expectedHash, bitObj.Hash160);
 }
Ejemplo n.º 5
0
 public static Hash160 Create(byte[] hashBytes)
 {
     Hash160 hash160 = new Hash160(hashBytes);
     return hash160;
 }