@Override public boolean isMatchingKey(AbstractKey key) { return getShortAddress().isMatchingKeyAddress(key.getShortAddress()); }
/** * Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contract is a copy * of this contract, with all fields and references correctly set. After this call one need to change mutable * fields, add signing keys, seal it and then apss to Universa network for approval. * * @param keys initially added and signer keys. Role "creator" is set to addresses of these keys * @param transactional is {@link Transactional} section to create new revision with * @return new revision of this contract, identical to this one, to be modified. */ public synchronized Contract createRevisionWithAddress(Collection<?> keys, Transactional transactional) { Contract newRevision = createRevision(transactional); Set<KeyAddress> aids = new HashSet<>(); AtomicBoolean returnNull = new AtomicBoolean(false); keys.forEach(k -> { if (k instanceof AbstractKey) aids.add(((AbstractKey) k).getPublicKey().getShortAddress()); else if (k instanceof KeyAddress) aids.add((KeyAddress)k); else returnNull.set(true); }); newRevision.setCreatorKeys(aids); if (returnNull.get()) return null; return newRevision; }
@Override public final boolean isMatchingKeyAddress(KeyAddress other) { return other.isLong() ? getLongAddress().isMatchingKeyAddress(other) : getShortAddress().isMatchingKeyAddress(other); }