From 03b2d82c09aa54cc7253353df57122925a087952 Mon Sep 17 00:00:00 2001 From: Giovanni Gargiulo Date: Thu, 28 Mar 2024 17:19:52 +0000 Subject: [PATCH 1/3] feat: adding isClient (or isServer) to State and Agents --- .../com/bloxbean/cardano/yaci/core/protocol/Agent.java | 10 ++++++++-- .../com/bloxbean/cardano/yaci/core/protocol/State.java | 2 +- .../yaci/core/protocol/handshake/HandshakeAgent.java | 3 ++- .../yaci/core/protocol/handshake/HandshkeState.java | 10 +++++----- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/Agent.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/Agent.java index e6e732f..c83b82a 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/Agent.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/Agent.java @@ -17,6 +17,12 @@ public abstract class Agent { private final List agentListeners = new ArrayList<>(); private AcceptVersion acceptVersion; + private final boolean isClient; + + public Agent(boolean isClient) { + this.isClient = isClient; + } + public void setChannel(Channel channel) { if (this.channel != null && this.channel.isActive()) log.warn("An active channel is already attached to this agent"); @@ -25,7 +31,7 @@ public void setChannel(Channel channel) { } public void sendRequest(Message message) { - if (currenState.hasAgency()) { + if (currenState.hasAgency(isClient)) { currenState = currenState.nextState(message); } else { //TODO @@ -69,7 +75,7 @@ public final void sendNextMessage() { } public final boolean hasAgency() { - return currenState.hasAgency(); + return currenState.hasAgency(isClient); } public final synchronized void addListener(T agentListener) { diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/State.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/State.java index ec357d8..ec6d056 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/State.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/State.java @@ -6,7 +6,7 @@ public interface State { State nextState(Message message); - boolean hasAgency(); + boolean hasAgency(boolean isClient); default Message handleInbound(byte[] bytes) { return null; diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshakeAgent.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshakeAgent.java index 5628348..c95c110 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshakeAgent.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshakeAgent.java @@ -14,7 +14,8 @@ public class HandshakeAgent extends Agent { private final VersionTable versionTable; - public HandshakeAgent(VersionTable versionTable) { + public HandshakeAgent(VersionTable versionTable, boolean isClient) { + super(isClient); this.versionTable = versionTable; this.currenState = Propose; } diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshkeState.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshkeState.java index ac33373..9eb721d 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshkeState.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshkeState.java @@ -10,8 +10,8 @@ public HandshkeState nextState(Message message) { } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } }, Confirm { @@ -21,8 +21,8 @@ public HandshkeState nextState(Message message) { } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, Done { @@ -32,7 +32,7 @@ public HandshkeState nextState(Message message) { } @Override - public boolean hasAgency() { + public boolean hasAgency(boolean isClient) { return false; } } From 99957b71ecc7a3a95e3e2fe3fbf81193c92e20e2 Mon Sep 17 00:00:00 2001 From: Giovanni Gargiulo Date: Fri, 5 Apr 2024 22:08:03 +0100 Subject: [PATCH 2/3] chore: updated all states --- .../protocol/blockfetch/BlockfetchState.java | 14 ++++++------ .../chainsync/n2c/LocalChainSyncState.java | 18 +++++++-------- .../chainsync/n2n/ChainSyncState.java | 18 +++++++-------- .../protocol/keepalive/KeepAliveState.java | 12 +++++----- .../localstate/LocalStateQueryState.java | 18 +++++++-------- .../localtx/LocalTxSubmissionState.java | 10 ++++----- .../localtxmonitor/LocalTxMonitorState.java | 18 +++++++-------- .../txsubmission/TxSubmissionState.java | 22 +++++++++---------- 8 files changed, 65 insertions(+), 65 deletions(-) diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/blockfetch/BlockfetchState.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/blockfetch/BlockfetchState.java index da60a2d..e5a1d69 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/blockfetch/BlockfetchState.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/blockfetch/BlockfetchState.java @@ -17,8 +17,8 @@ else if (message instanceof ClientDone) } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } }, Busy { @@ -33,8 +33,8 @@ else if (message instanceof StartBatch) } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, Streaming { @@ -49,8 +49,8 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, Done { @@ -60,7 +60,7 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { + public boolean hasAgency(boolean isClient) { return false; } } diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2c/LocalChainSyncState.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2c/LocalChainSyncState.java index 114b9f1..125e3e6 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2c/LocalChainSyncState.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2c/LocalChainSyncState.java @@ -21,8 +21,8 @@ else if (message instanceof ChainSyncMsgDone) } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } }, CanAwait { @@ -39,8 +39,8 @@ else if (message instanceof Rollbackward) } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, MustReply { @@ -55,8 +55,8 @@ else if (message instanceof Rollbackward) } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, Intersect { @@ -71,8 +71,8 @@ else if (message instanceof IntersectNotFound) } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, Done { @@ -82,7 +82,7 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { + public boolean hasAgency(boolean isClient) { return false; } } diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2n/ChainSyncState.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2n/ChainSyncState.java index 150f22b..88ab67d 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2n/ChainSyncState.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2n/ChainSyncState.java @@ -21,8 +21,8 @@ else if (message instanceof ChainSyncMsgDone) } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } }, CanAwait { @@ -39,8 +39,8 @@ else if (message instanceof Rollbackward) } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, MustReply { @@ -55,8 +55,8 @@ else if (message instanceof Rollbackward) } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, Intersect { @@ -71,8 +71,8 @@ else if (message instanceof IntersectNotFound) } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, Done { @@ -82,7 +82,7 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { + public boolean hasAgency(boolean isClient) { return false; } } diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/keepalive/KeepAliveState.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/keepalive/KeepAliveState.java index 9cd81d3..29c30ad 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/keepalive/KeepAliveState.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/keepalive/KeepAliveState.java @@ -17,8 +17,8 @@ else if (message instanceof MsgDone) } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } }, Server { @@ -28,8 +28,8 @@ public KeepAliveState nextState(Message message) { } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, Done { @@ -39,8 +39,8 @@ public KeepAliveState nextState(Message message) { } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } } } diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/LocalStateQueryState.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/LocalStateQueryState.java index 7ad8b2c..f70fb7e 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/LocalStateQueryState.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/LocalStateQueryState.java @@ -20,8 +20,8 @@ else if (message instanceof MsgDone) } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } List allowedMsgTypes = List.of(MsgAcquire.class, MsgDone.class); @@ -44,8 +44,8 @@ else if (message instanceof MsgFailure) } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } List allowedMsgTypes = List.of(MsgAcquired.class, MsgFailure.class); @@ -70,8 +70,8 @@ else if (message instanceof MsgRelease) } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } List allowedMsgTypes = List.of(MsgQuery.class, MsgReAcquire.class, MsgRelease.class); @@ -92,8 +92,8 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } List allowedMsgTypes = List.of(MsgResult.class); @@ -111,7 +111,7 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { + public boolean hasAgency(boolean isClient) { return false; } } diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtx/LocalTxSubmissionState.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtx/LocalTxSubmissionState.java index ccb2503..e66803a 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtx/LocalTxSubmissionState.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtx/LocalTxSubmissionState.java @@ -20,8 +20,8 @@ else if (message instanceof MsgDone) } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } }, Busy { @@ -34,8 +34,8 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, Done { @@ -45,7 +45,7 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { + public boolean hasAgency(boolean isClient) { return false; } } diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtxmonitor/LocalTxMonitorState.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtxmonitor/LocalTxMonitorState.java index cc37ce6..2af3e22 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtxmonitor/LocalTxMonitorState.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtxmonitor/LocalTxMonitorState.java @@ -19,8 +19,8 @@ else if (message instanceof MsgDone) } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } List allowedMsgTypes = List.of(MsgAwaitAcquire.class, MsgAcquire.class, MsgDone.class); @@ -40,8 +40,8 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } List allowedMsgTypes = List.of(MsgAcquired.class); @@ -65,8 +65,8 @@ else if (message instanceof MsgHasTx || message instanceof MsgNextTx || message } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } List allowedMsgTypes = List.of(MsgAwaitAcquire.class, MsgRelease.class, MsgHasTx.class, MsgNextTx.class, MsgGetSizes.class); @@ -86,8 +86,8 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } List allowedMsgTypes = List.of(MsgReplyHasTx.class, MsgReplyNextTx.class, MsgReplyGetSizes.class); @@ -104,7 +104,7 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { + public boolean hasAgency(boolean isClient) { return false; } } diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/txsubmission/TxSubmissionState.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/txsubmission/TxSubmissionState.java index 93a62cc..fab5bd1 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/txsubmission/TxSubmissionState.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/txsubmission/TxSubmissionState.java @@ -18,8 +18,8 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } }, Idle { @@ -35,8 +35,8 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { - return false; + public boolean hasAgency(boolean isClient) { + return !isClient; } }, TxIdsBlocking { @@ -49,8 +49,8 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } }, TxIdsNonBlocking { @@ -63,8 +63,8 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } }, Txs { @@ -77,8 +77,8 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { - return true; + public boolean hasAgency(boolean isClient) { + return isClient; } }, Done { @@ -88,7 +88,7 @@ public State nextState(Message message) { } @Override - public boolean hasAgency() { + public boolean hasAgency(boolean isClient) { return false; } } From fd1624ecef869602bab6e8afdaf5af7deb50e681 Mon Sep 17 00:00:00 2001 From: Giovanni Gargiulo Date: Fri, 5 Apr 2024 22:15:13 +0100 Subject: [PATCH 3/3] chore: updated agents w/ default isClient falg --- .../yaci/core/protocol/blockfetch/BlockfetchAgent.java | 4 ++++ .../core/protocol/chainsync/n2c/LocalChainSyncAgent.java | 8 ++++++++ .../yaci/core/protocol/chainsync/n2n/ChainsyncAgent.java | 8 ++++++++ .../yaci/core/protocol/handshake/HandshakeAgent.java | 3 +++ .../yaci/core/protocol/keepalive/KeepAliveAgent.java | 4 ++++ .../core/protocol/localstate/LocalStateQueryAgent.java | 4 ++++ .../core/protocol/localtx/LocalTxSubmissionAgent.java | 4 ++++ .../core/protocol/localtxmonitor/LocalTxMonitorAgent.java | 4 ++++ .../core/protocol/txsubmission/TxSubmissionAgent.java | 4 ++++ 9 files changed, 43 insertions(+) diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/blockfetch/BlockfetchAgent.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/blockfetch/BlockfetchAgent.java index 31fbd7e..07dafea 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/blockfetch/BlockfetchAgent.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/blockfetch/BlockfetchAgent.java @@ -32,6 +32,10 @@ public class BlockfetchAgent extends Agent { private long errorBlks; public BlockfetchAgent() { + this(true); + } + public BlockfetchAgent(boolean isClient) { + super(isClient); this.currenState = Idle; this.startTime = System.currentTimeMillis(); diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2c/LocalChainSyncAgent.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2c/LocalChainSyncAgent.java index eb9ac4a..f85b335 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2c/LocalChainSyncAgent.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2c/LocalChainSyncAgent.java @@ -21,6 +21,10 @@ public class LocalChainSyncAgent extends Agent { private int counter = 0; public LocalChainSyncAgent(Point[] knownPoints) { + this(knownPoints, true); + } + public LocalChainSyncAgent(Point[] knownPoints, boolean isClient) { + super(isClient); this.currenState = Idle; this.knownPoints = knownPoints; @@ -29,6 +33,10 @@ public LocalChainSyncAgent(Point[] knownPoints) { } public LocalChainSyncAgent(Point[] knownPoints, long stopSlotNo, int agentNo) { + this(knownPoints,stopSlotNo, agentNo, true); + } + public LocalChainSyncAgent(Point[] knownPoints, long stopSlotNo, int agentNo, boolean isClient) { + super(isClient); this.currenState = Idle; this.knownPoints = knownPoints; this.stopAt = stopSlotNo; diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2n/ChainsyncAgent.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2n/ChainsyncAgent.java index c8e910f..b654c03 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2n/ChainsyncAgent.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/chainsync/n2n/ChainsyncAgent.java @@ -23,6 +23,10 @@ public class ChainsyncAgent extends Agent { private long startTime; public ChainsyncAgent(Point[] knownPoints) { + this(knownPoints, true); + } + public ChainsyncAgent(Point[] knownPoints, boolean isClient) { + super(isClient); this.currenState = Idle; this.knownPoints = knownPoints; @@ -31,6 +35,10 @@ public ChainsyncAgent(Point[] knownPoints) { } public ChainsyncAgent(Point[] knownPoints, long stopSlotNo, int agentNo) { + this(knownPoints, stopSlotNo, agentNo, true); + } + public ChainsyncAgent(Point[] knownPoints, long stopSlotNo, int agentNo, boolean isClient) { + super(isClient); this.currenState = Idle; this.knownPoints = knownPoints; this.stopAt = stopSlotNo; diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshakeAgent.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshakeAgent.java index c95c110..6df2e15 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshakeAgent.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/handshake/HandshakeAgent.java @@ -14,6 +14,9 @@ public class HandshakeAgent extends Agent { private final VersionTable versionTable; + public HandshakeAgent(VersionTable versionTable) { + this(versionTable,true); + } public HandshakeAgent(VersionTable versionTable, boolean isClient) { super(isClient); this.versionTable = versionTable; diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/keepalive/KeepAliveAgent.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/keepalive/KeepAliveAgent.java index 7e008b0..ad8f669 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/keepalive/KeepAliveAgent.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/keepalive/KeepAliveAgent.java @@ -21,6 +21,10 @@ public class KeepAliveAgent extends Agent { private Queue reqQueue; public KeepAliveAgent() { + this(true); + } + public KeepAliveAgent(boolean isClient) { + super(isClient); this.currenState = Client; this.reqQueue = new ConcurrentLinkedQueue<>(); } diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/LocalStateQueryAgent.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/LocalStateQueryAgent.java index 10bcbfb..fe79f57 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/LocalStateQueryAgent.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/LocalStateQueryAgent.java @@ -24,6 +24,10 @@ public class LocalStateQueryAgent extends Agent { private Queue pendingQueryCommands; public LocalStateQueryAgent() { + this(true); + } + public LocalStateQueryAgent(boolean isClient) { + super(isClient); this.currenState = Idle; acquiredCommands = new ConcurrentLinkedQueue<>(); diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtx/LocalTxSubmissionAgent.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtx/LocalTxSubmissionAgent.java index a8f3239..1893192 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtx/LocalTxSubmissionAgent.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtx/LocalTxSubmissionAgent.java @@ -19,6 +19,10 @@ public class LocalTxSubmissionAgent extends Agent { private Queue pendingQueue; public LocalTxSubmissionAgent() { + this(true); + } + public LocalTxSubmissionAgent(boolean isClient) { + super(isClient); txnQueue = new ConcurrentLinkedQueue<>(); pendingQueue = new ConcurrentLinkedQueue<>(); this.currenState = LocalTxSubmissionState.Idle; diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtxmonitor/LocalTxMonitorAgent.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtxmonitor/LocalTxMonitorAgent.java index 33d1b61..a47ac67 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtxmonitor/LocalTxMonitorAgent.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localtxmonitor/LocalTxMonitorAgent.java @@ -19,6 +19,10 @@ public class LocalTxMonitorAgent extends Agent { private Queue pendingQueryQueue; public LocalTxMonitorAgent() { + this(true); + } + public LocalTxMonitorAgent(boolean isClient) { + super(isClient); this.currenState = Idle; this.acquiredCommands = new ConcurrentLinkedQueue<>(); this.pendingQueryQueue = new ConcurrentLinkedQueue<>(); diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/txsubmission/TxSubmissionAgent.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/txsubmission/TxSubmissionAgent.java index ae01317..66677da 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/txsubmission/TxSubmissionAgent.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/txsubmission/TxSubmissionAgent.java @@ -17,6 +17,10 @@ public class TxSubmissionAgent extends Agent { private final List reqNonBlockingTxIds; public TxSubmissionAgent() { + this(true); + } + public TxSubmissionAgent(boolean isClient) { + super(isClient); this.currenState = TxSubmissionState.Init; txs = new HashMap<>(); reqTxIds = new ArrayList<>();