public static void ValidPayToScriptHashAddresses(string encodedAddress, BlockChainIdentity intendedBlockChain) { Address address; Assert.True(Address.TryDecode(encodedAddress, out address)); address = Address.Decode(encodedAddress); Assert.IsType <Address.PayToScriptHash>(address); var p2shAddress = (Address.PayToScriptHash)address; Assert.Same(address.IntendedBlockChain, intendedBlockChain); var newAddress = new Address.PayToPubKeyHash(intendedBlockChain, p2shAddress.ScriptHash); var reencodedAddress = address.Encode(); Assert.Equal(encodedAddress, reencodedAddress); }
public static void ValidPayToPubKeyHashAddresses(string encodedAddress, BlockChainIdentity intendedBlockChain) { // Assert TryDecode and Decode succeed on valid address. Address address; Assert.True(Address.TryDecode(encodedAddress, out address)); address = Address.Decode(encodedAddress); // Assert actual instance type is PayToPubKeyHash Assert.IsType <Address.PayToPubKeyHash>(address); var p2pkhAddress = (Address.PayToPubKeyHash)address; // Assert address is for the correct intended network. Assert.Same(address.IntendedBlockChain, intendedBlockChain); // Assert reencoded address string is equal to the test input. var newAddress = new Address.PayToPubKeyHash(intendedBlockChain, p2pkhAddress.PubKeyHash); var reencodedAddress = newAddress.Encode(); Assert.Equal(encodedAddress, reencodedAddress); }