Esempio n. 1
0
        public override bool Equals(object obj)
        {
            EscrowScriptPubKeyParameters item = obj as EscrowScriptPubKeyParameters;

            if (item == null)
            {
                return(false);
            }
            return(ToScript().Equals(item.ToScript()));
        }
Esempio n. 2
0
        private static EscrowScriptPubKeyParameters GetFromScript(Script script)
        {
            EscrowScriptPubKeyParameters parameters = new EscrowScriptPubKeyParameters();

            try
            {
                var data = script.ToOps().Where(o => o.PushData != null).ToArray();
                parameters.Initiator = new PubKey(data[0].PushData);
                parameters.Receiver  = new PubKey(data[2].PushData);
                parameters.LockTime  = new LockTime(data[3].GetInt().Value);
                //Verify it is the same as if we had done it
                if (parameters.ToScript() != script)
                {
                    throw new Exception();
                }
                return(parameters);
            }
            catch { return(null); }
        }