/// Quick test for pay-to-script-hash CScripts
/// </summary>
/// <returns>Checking result</returns>
- public bool IsPayToScriptHash()
+ public bool IsPayToScriptHash
{
- // Sender provides redeem script hash, receiver provides signature list and redeem script
- // OP_HASH160 20 [20 byte hash] OP_EQUAL
- return (codeBytes.Count() == 23 &&
- codeBytes[0] == (byte)opcodetype.OP_HASH160 &&
- codeBytes[1] == 0x14 && // 20 bytes hash length prefix
- codeBytes[22] == (byte)opcodetype.OP_EQUAL);
+ get
+ {
+ // Sender provides redeem script hash, receiver provides signature list and redeem script
+ // OP_HASH160 20 [20 byte hash] OP_EQUAL
+ return (codeBytes.Count() == 23 &&
+ codeBytes[0] == (byte)opcodetype.OP_HASH160 &&
+ codeBytes[1] == 0x14 && // 20 bytes hash length prefix
+ codeBytes[22] == (byte)opcodetype.OP_EQUAL);
+ }
}
/// <summary>
/// Quick test for pay-to-pubkeyhash CScripts
/// </summary>
/// <returns>Checking result</returns>
- public bool IsPayToPubKeyHash()
+ public bool IsPayToPubKeyHash
{
- // Sender provides hash of pubkey, receiver provides signature and pubkey
- // OP_DUP OP_HASH160 20 [20 byte hash] OP_EQUALVERIFY OP_CHECKSIG
-
- return (codeBytes.Count == 25 &&
- codeBytes[0] == (byte) opcodetype.OP_DUP &&
- codeBytes[1] == (byte)opcodetype.OP_HASH160 &&
- codeBytes[2] == 0x14 && // 20 bytes hash length prefix
- codeBytes[23] == (byte)opcodetype.OP_EQUALVERIFY &&
- codeBytes[24] == (byte)opcodetype.OP_CHECKSIG);
+ get
+ {
+ // Sender provides hash of pubkey, receiver provides signature and pubkey
+ // OP_DUP OP_HASH160 20 [20 byte hash] OP_EQUALVERIFY OP_CHECKSIG
+
+ return (codeBytes.Count == 25 &&
+ codeBytes[0] == (byte)opcodetype.OP_DUP &&
+ codeBytes[1] == (byte)opcodetype.OP_HASH160 &&
+ codeBytes[2] == 0x14 && // 20 bytes hash length prefix
+ codeBytes[23] == (byte)opcodetype.OP_EQUALVERIFY &&
+ codeBytes[24] == (byte)opcodetype.OP_CHECKSIG);
+ }
}
/// <summary>
/// <returns>SigOps count</returns>
public int GetSigOpCount(CScript scriptSig)
{
- if (!IsPayToScriptHash())
+ if (!IsPayToScriptHash)
{
return GetSigOpCount(true);
}
foreach (CPubKey key in keys)
{
- PushData(key.Public.ToList());
+ PushData(key.PublicBytes.ToList());
}
AddOp(ScriptCode.EncodeOP_N(keys.Count()));
AddOp(opcodetype.OP_CHECKMULTISIG);