Esempio n. 1
0
 public virtual void AddContract(VerificationContract contract)
 {
     lock (keys)
     {
         if (!keys.ContainsKey(contract.PublicKeyHash))
         {
             throw new InvalidOperationException();
         }
         lock (contracts)
             lock (watchOnly)
             {
                 contracts[contract.ScriptHash] = contract;
                 watchOnly.Remove(contract.ScriptHash);
             }
     }
 }
Esempio n. 2
0
        public bool Sign(ContractParametersContext context)
        {
            bool fSuccess = false;

            foreach (UInt160 scriptHash in context.ScriptHashes)
            {
                VerificationContract contract = GetContract(scriptHash);
                if (contract == null)
                {
                    continue;
                }
                KeyPair key = GetKeyByScriptHash(scriptHash);
                if (key == null)
                {
                    continue;
                }
                byte[] signature = context.Verifiable.Sign(key);
                fSuccess |= context.AddSignature(contract, key.PublicKey, signature);
            }
            return(fSuccess);
        }