Esempio n. 1
0
        public void StateRefDocBlockHash()
        {
            var address = new PrivateKey().ToAddress();
            var random  = new Random();
            var bytes   = new byte[32];

            random.NextBytes(bytes);
            var hashDigest = new HashDigest <SHA256>(bytes);
            var stateRef   = new DefaultStore.StateRefDoc
            {
                StateKey   = address.ToHex().ToLowerInvariant(),
                BlockIndex = 123,
                BlockHash  = hashDigest,
            };
            var stateRef2 = new DefaultStore.StateRefDoc
            {
                StateKey        = stateRef.StateKey,
                BlockIndex      = 123,
                BlockHashString = stateRef.BlockHashString,
            };

            Assert.Equal(stateRef.BlockHash, stateRef2.BlockHash);
        }
Esempio n. 2
0
        public void StateRefDocBlockHash()
        {
            var address = new PrivateKey().PublicKey.ToAddress();
            var random  = new Random();
            var bytes   = new byte[32];

            random.NextBytes(bytes);
            var hashDigest = new HashDigest <SHA256>(bytes);
            var stateRef   = new DefaultStore.StateRefDoc
            {
                Address    = address,
                BlockIndex = 123,
                BlockHash  = hashDigest,
            };
            var stateRef2 = new DefaultStore.StateRefDoc
            {
                AddressString   = stateRef.AddressString,
                BlockIndex      = 123,
                BlockHashString = stateRef.BlockHashString,
            };

            Assert.Equal(stateRef.Address, stateRef2.Address);
            Assert.Equal(stateRef.BlockHash, stateRef2.BlockHash);
        }