diff --git a/convex-peer/src/main/java/convex/api/Convex.java b/convex-peer/src/main/java/convex/api/Convex.java index 9a817ea6a..c92ddb17a 100644 --- a/convex-peer/src/main/java/convex/api/Convex.java +++ b/convex-peer/src/main/java/convex/api/Convex.java @@ -383,16 +383,22 @@ private synchronized ATransaction applyNextSequence(ATransaction t) { * @throws IOException If an IO Exception occurs (most likely the connection is broken) */ public synchronized CompletableFuture transact(ATransaction transaction) throws IOException { - if (transaction.getOrigin() == null) { - transaction = transaction.withOrigin(address); + Address origin=transaction.getOrigin(); + if (origin == null) { + origin=address; + transaction = transaction.withOrigin(origin); + } long seq=transaction.getSequence(); - if (autoSequence && (seq <= 0)) { - Address origin=transaction.getOrigin(); - // apply sequence if using expected address - if (Utils.equals(origin, address)) { - transaction = applyNextSequence(transaction); + if (autoSequence) { + if (seq <= 0) { + // apply sequence if using expected address + if (Utils.equals(origin, address)) { + transaction = applyNextSequence(transaction); + } } + + // If local, do extra Server s=getLocalServer(); if (s!=null) { State state=s.getPeer().getConsensusState();