public void updateExclusiveSyncPoint()

in accord-core/src/main/java/accord/impl/InMemoryCommandStore.java [785:826]


        public void updateExclusiveSyncPoint(Command prev, Command updated)
        {
            super.updateExclusiveSyncPoint(prev, updated);
            if (updated.txnId().kind() != Txn.Kind.ExclusiveSyncPoint || updated.txnId().domain() != Range || !updated.hasBeen(Applied) || prev.hasBeen(Applied) || updated.hasBeen(Truncated)) return;

            Participants<?> covering = updated.participants().touches();
            for (Map.Entry<TxnId, GlobalCommand> entry : commandStore().commands.headMap(updated.txnId(), false).entrySet())
            {
                Command command = entry.getValue().value();
                TxnId txnId = command.txnId();
                if (!command.hasBeen(Committed)) continue;
                if (command.hasBeen(Applied)) continue;
                if (txnId.is(EphemeralRead)) continue;
                Participants<?> intersecting = (txnId.is(ExclusiveSyncPoint) ? command.participants().owns(): command.participants().stillWaitsOn()).intersecting(covering, Minimal);
                if (intersecting.isEmpty()) continue;
                if (commandStore().unsafeGetRedundantBefore().locallyDefunct(command.txnId(), intersecting) == ALL) continue;
                if (txnId.is(Key))
                {
                    // TODO (required): document our invariants around this scenario, where a transaction with a higher txnId
                    //  but lower executeAt than a transaction that is pre-bootstrap is ignore by the CFK (but cannot be validated to be pre-bootstrap independently).
                    //  This invariant requires a timestamp store for correctness at least (as do other protocol assumptions).
                    //  Make sure these invariants are validated in all relevant locations in the burn test.
                    boolean isShadowedByPreBootstrap = true;
                    for (RoutingKey key : (AbstractUnseekableKeys)command.participants().executes())
                    {
                        SafeCommandsForKey safeCfk = commandsForKey.get(key);
                        CommandsForKey cfk = safeCfk.current();
                        int i = cfk.indexOf(cfk.bootstrappedAt());
                        if (i < 0) i = -1 - i;
                        while (--i >= 0)
                        {
                            CommandsForKey.TxnInfo txn = cfk.get(i);
                            if (txn.isCommittedToExecute() && txn.executeAt.compareTo(cfk.bootstrappedAt()) > 0)
                                break;
                        }
                        isShadowedByPreBootstrap &= i >= 0;
                    }
                    if (isShadowedByPreBootstrap) continue;
                }
                illegalState();
            }
        }