From c4c883c1fbf47f656b3a923f0e446553718791a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Novo?= <34069419+TeknoPT@users.noreply.github.com> Date: Wed, 11 Oct 2023 16:59:34 +0100 Subject: [PATCH] Fix's to the docker files and the ABCI. - Fix DockerFiles - Fix ABCI Connector issue if the block was null . --- DOCKER/DockerfileTestnet | 3 +-- DOCKER/DockerfileTestnetDebug | 1 - Phantasma.Node/src/ABCIConnector.cs | 34 +++++++++++++++++------------ 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/DOCKER/DockerfileTestnet b/DOCKER/DockerfileTestnet index 21d39c31..225add70 100644 --- a/DOCKER/DockerfileTestnet +++ b/DOCKER/DockerfileTestnet @@ -9,8 +9,7 @@ COPY DOCKER/bin /app/bin RUN apt-get update; apt-get install -y inotify-tools libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev libzstd-dev libc6-dev libicu-dev libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev libzstd-dev librocksdb-dev libc6-dev libsnappy-dev libicu-dev screen bash vim net-tools ca-certificates openssl libssl-dev libgdiplus libx11-dev nano -#EXPOSE 7077 7078 7079 7080 26056 26156 26256 26356 26057 26157 26257 26357 -EXPOSE 7078 7079 7080 26156 26256 26356 26157 26257 26357 +EXPOSE 7077 7078 7079 7080 26056 26156 26256 26356 26057 26157 26257 26357 RUN chmod +x /app/wrapper-testnet.sh ENTRYPOINT ["/app/wrapper-testnet.sh"] diff --git a/DOCKER/DockerfileTestnetDebug b/DOCKER/DockerfileTestnetDebug index 18490825..979ead13 100644 --- a/DOCKER/DockerfileTestnetDebug +++ b/DOCKER/DockerfileTestnetDebug @@ -8,7 +8,6 @@ COPY DOCKER/bin /app/bin RUN apt-get update; apt-get install -y libc6-dev libsnappy-dev libicu-dev screen bash vim net-tools ca-certificates openssl libssl-dev librocksdb-dev nano -#EXPOSE 7077 7078 7079 7080 26056 26156 26256 26356 26057 26157 26257 26357 EXPOSE 7078 7079 7080 26156 26256 26356 26157 26257 26357 RUN chmod +x /app/wrapper-testnet-debug.sh diff --git a/Phantasma.Node/src/ABCIConnector.cs b/Phantasma.Node/src/ABCIConnector.cs index c3784b3b..ee416def 100644 --- a/Phantasma.Node/src/ABCIConnector.cs +++ b/Phantasma.Node/src/ABCIConnector.cs @@ -293,27 +293,33 @@ public override Task Commit(RequestCommit request, ServerCallCon Log.Information($"ABCI Connector - Commit"); var chain = _nexus.RootChain as Chain; + var attempts = 2; // Is signed by me and I am the proposer - if ( chain.CurrentBlock != null) - Log.Information("Block {Height} is signed by {Address}", chain.Height, chain.CurrentBlock.Validator); - - if (chain.CurrentBlock.Validator == chain.ValidatorAddress) - { - Log.Information("Block {Height} Is Being Validated by me."); - chain.Commit(); - } - else + if (chain.CurrentBlock != null) { - var attempts = 2; - while (chain.CurrentBlock != null && attempts-- > 0) + Log.Information("Block {Height} is signed by {Address}", chain.Height, chain.CurrentBlock.Validator); + if (chain.CurrentBlock.Validator == chain.ValidatorAddress) + { + Log.Information("Block {Height} Is Being Validated by me."); + chain.Commit(); + } + else { - AttemptRequestBlock(chain); + while (chain.CurrentBlock != null && attempts-- > 0) + { + AttemptRequestBlock(chain); - Thread.Sleep(_delayRequests); + Thread.Sleep(_delayRequests); + } + //var data = chain.Commit(); } - //var data = chain.Commit(); } + else + { + Log.Error("Block {Height} Is Null.", chain.Height); + } + var response = new ResponseCommit(); //response.Data = ByteString.CopyFrom(data); // this would change the app hash, we don't want that