private string GetAddress(BIP0137.AddressType addrType) { return(addrType switch { BIP0137.AddressType.P2PKH_Uncompressed => KeyHelper.Pub1UnCompAddr, BIP0137.AddressType.P2PKH_Compressed => KeyHelper.Pub1CompAddr, BIP0137.AddressType.P2SH_P2WPKH => KeyHelper.Pub1NestedSegwit, BIP0137.AddressType.P2WPKH => KeyHelper.Pub1BechAddr, _ => throw new ArgumentException("Address type is not defined."), });
public void SignTest(BIP0137.AddressType addrType, byte[] expected, byte[] expectedIgnore) { BIP0137 bip = new BIP0137(); Signature sig1 = bip.Sign(KeyHelper.Prv1, KeyHelper.Msg1ToSign, addrType, false); byte[] actual1 = sig1.ToByteArrayWithRecId(); Signature sig2 = bip.Sign(KeyHelper.Prv1, KeyHelper.Msg1ToSign, addrType, true); byte[] actual2 = sig2.ToByteArrayWithRecId(); Assert.Equal(expected, actual1); Assert.Equal(expectedIgnore, actual2); }