public uint GetSigOpCount(Script scriptSig) { if(!IsPayToScriptHash) return GetSigOpCount(true); // This is a pay-to-script-hash scriptPubKey; // get the last item that the scriptSig // pushes onto the stack: var validSig = new PayToScriptHashTemplate().CheckScriptSig(scriptSig, this); return !validSig ? 0 : new Script(scriptSig.ToOps().Last().PushData).GetSigOpCount(true); // ... and return its opcount: }
public uint GetSigOpCount(Script scriptSig) { if (!IsPayToScriptHash) { return(GetSigOpCount(true)); } // This is a pay-to-script-hash scriptPubKey; // get the last item that the scriptSig // pushes onto the stack: var validSig = new PayToScriptHashTemplate() { VerifyRedeemScript = false }.CheckScriptSig(scriptSig, null); if (!validSig) { return(0); } /// ... and return its opcount: return(new Script(scriptSig.ToOps().Last().PushData).GetSigOpCount(true)); }
public void SetDestination(ScriptId scriptId) { ScriptPubKey = new PayToScriptHashTemplate().GenerateScriptPubKey(scriptId); }
public BitcoinScriptAddress GetScriptAddress(Network network) { var redeem = new PayToScriptHashTemplate().GenerateScriptPubKey(new PayToPubkeyTemplate().GenerateScriptPubKey(this)); return(new BitcoinScriptAddress(redeem.ID, network)); }
public uint GetSigOpCount(Script scriptSig) { if(!IsPayToScriptHash) return GetSigOpCount(true); // This is a pay-to-script-hash scriptPubKey; // get the last item that the scriptSig // pushes onto the stack: var validSig = new PayToScriptHashTemplate() { VerifyRedeemScript = false }.CheckScriptSig(scriptSig, null); if(!validSig) return 0; /// ... and return its opcount: return new Script(scriptSig.ToOps().Last().PushData).GetSigOpCount(true); }