/** * Add contract that already includes all its subItems, referenced items and keys. It will be added as a contract * per transaction, while its subItems will be added to subItems if not already included and refrenced items and keys too. * <p> * This is extremely important that the contract is properly sealed as well as its possibly new items, revoking * items and referenced items have binary image attached. <b>Do not ever seal the approved contract</b>: * it will break it's id and cancel the approval blockchain, so the new state will not be approved. * If it was done by mistake, reload the packed contract to continue. * * @param c is a contract to append to the list of transactions. */ public void setContract(Contract c) { if (contract != null) throw new IllegalArgumentException("the contract is already added"); contract = c; packedBinary = null; extractAllSubItemsAndReferenced(c); c.setTransactionPack(this); for (PrivateKey key : c.getKeysToSignWith()) addKeys(key.getPublicKey()); }