本文整理匯總了C#中System.Script.GetSigOpCount方法的典型用法代碼示例。如果您正苦於以下問題:C# Script.GetSigOpCount方法的具體用法?C# Script.GetSigOpCount怎麽用?C# Script.GetSigOpCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Script
的用法示例。
在下文中一共展示了Script.GetSigOpCount方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetSigOpCount
public void GetSigOpCount()
{
// Test CScript::GetSigOpCount()
Script s1 = new Script();
Assert.Equal(s1.GetSigOpCount(false), 0U);
Assert.Equal(s1.GetSigOpCount(true), 0U);
uint160 dummy = new uint160(0);
s1 = s1 + OpcodeType.OP_1 + dummy.ToBytes() + dummy.ToBytes() + OpcodeType.OP_2 + OpcodeType.OP_CHECKMULTISIG;
Assert.Equal(s1.GetSigOpCount(true), 2U);
s1 = s1 + OpcodeType.OP_IF + OpcodeType.OP_CHECKSIG + OpcodeType.OP_ENDIF;
Assert.Equal(s1.GetSigOpCount(true), 3U);
Assert.Equal(s1.GetSigOpCount(false), 21U);
Script p2sh = PayToScriptHashTemplate.Instance.GenerateScriptPubKey(s1);
Script scriptSig = PayToScriptHashTemplate.Instance.GenerateScriptSig(new[] { (Op)OpcodeType.OP_0 }, s1);
Assert.Equal(p2sh.GetSigOpCount(scriptSig), 3U);
PubKey[] keys = Enumerable.Range(0, 3).Select(_ => new Key(true).PubKey).ToArray();
Script s2 = PayToMultiSigTemplate.Instance.GenerateScriptPubKey(1, keys);
Assert.Equal(s2.GetSigOpCount(true), 3U);
Assert.Equal(s2.GetSigOpCount(false), 20U);
p2sh = PayToScriptHashTemplate.Instance.GenerateScriptPubKey(s2);
Assert.Equal(p2sh.GetSigOpCount(true), 0U);
Assert.Equal(p2sh.GetSigOpCount(false), 0U);
Script scriptSig2 = new Script();
scriptSig2 = scriptSig2 + OpcodeType.OP_1 + dummy.ToBytes() + dummy.ToBytes() + s2.ToBytes();
Assert.Equal(p2sh.GetSigOpCount(scriptSig2), 3U);
}