def is_valid(self):
    if (self.signature is None):
        return True
    if ((len(self.signature) == 0) and (self.to_address is None)):
        return False
    hash_tx = self.calculate_hash()
    pubkey = keys.get_public_keys_from_sig(self.signature, hash_tx, curve=curve.P256, hashfunc=sha256)
    valid = ecdsa.verify(self.signature, hash_tx, pubkey[0], hashfunc=sha256)
    return valid
def is_valid(self):
    if (self.signature is None):
        return True
    if ((len(self.signature) == 0) and (self.to_address is None)):
        return False
    hash_tx = self.calculate_hash()
    pubkey = keys.get_public_keys_from_sig(self.signature, hash_tx, curve=curve.P256, hashfunc=sha256)
    valid = ecdsa.verify(self.signature, hash_tx, pubkey[0], hashfunc=sha256)
    return valid