def Sign(self, context): """ Sign the verifiable items ( Transaction, Block, etc ) in the context with the Keypairs in this wallet. Args: context (ContractParameterContext): the context to sign Returns: bool: if signing is successful for all contracts in this wallet. """ success = False for hash in context.ScriptHashes: contract = self.GetContract(hash) if contract is None: continue key = self.GetKeyByScriptHash(hash) if key is None: continue signature = Helper.Sign(context.Verifiable, key) res = context.AddSignature(contract, key.PublicKey, signature) success |= res return success
def Sign(self, context): success = False for hash in context.ScriptHashes: print("checkhing hash...") contract = self.GetContract(hash) if contract is None: print("contract is none, return") continue key = self.GetKeyByScriptHash(hash) print("key is %s " % key) if key is None: print("key is none") continue print("Signing.... %s %s " % (context.Verifiable, key)) signature = Helper.Sign(context.Verifiable, key) print("signature %s " % signature) res = context.AddSignature(contract, key.PublicKey, signature) print("result is %s " % res) success |= res print("success is %s " % success) return success
def Sign(self, context): success = False for hash in context.ScriptHashes: contract = self.GetContract(hash) if contract is None: continue key = self.GetKeyByScriptHash(hash) if key is None: continue signature = Helper.Sign(context.Verifiable, key) success |= context.AddSignature(contract, key.PublicKey, signature) return success