Example #1
0
        public void SetToP2SH_P2WPKH_ExceptionTest()
        {
            PubkeyScript scr = new PubkeyScript();

            Assert.Throws <ArgumentNullException>(() => scr.SetToP2SH_P2WPKH(null, true));
            Assert.Throws <ArgumentNullException>(() => scr.SetToP2SH_P2WPKH(null));
            Assert.Throws <ArgumentException>(()
                                              => scr.SetToP2SH_P2WPKH(new MockSerializableRedeemScript(RedeemScriptType.Empty, new byte[0], 1)));
        }
Example #2
0
        public void SetToP2SH_P2WPKH_FromPubkeyTest(PublicKey pub, bool comp, byte[] expected)
        {
            PubkeyScript scr = new PubkeyScript();

            scr.SetToP2SH_P2WPKH(pub, comp);
            Assert.Equal(expected, scr.Data);
        }
Example #3
0
        public void SetToP2SH_P2WPKH_FromScriptTest()
        {
            PubkeyScript scr    = new PubkeyScript();
            var          redeem = new MockSerializableRedeemScript(RedeemScriptType.P2SH_P2WPKH, new byte[] { 1, 2, 3 }, 255);

            scr.SetToP2SH_P2WPKH(redeem);
            byte[] expected = Helper.HexToBytes($"a9149bc4860bb936abf262d7a51f74b4304833fee3b287");
            Assert.Equal(expected, scr.Data);
        }