Contract id mismatch log message. (#227)

* Added contract id mismatch log.
* Added individual docker image run script.
This commit is contained in:
Ravin Perera
2021-01-22 16:36:34 +05:30
committed by GitHub
parent 610b67cec0
commit 70493d827d
3 changed files with 33 additions and 2 deletions

View File

@@ -104,7 +104,10 @@ namespace p2p
// Check whether contract ids match.
if (chall.contract_id != conf::cfg.contract.id)
{
LOG_ERROR << "Contract id mismatch. Dropping connection " << session.display_name();
return -1;
}
// Sending the challenge response to the sender.
flatbuffers::FlatBufferBuilder fbuf(1024);

View File

@@ -1,8 +1,8 @@
#!/bin/bash
# Runs the specified node contract with hpcore docker image.
# Runs the specified node of the local cluster with hpcore docker image. (created via cluster-create.sh)
# This script assumes you already have the hpcore docker image and 'hpnet' virtual docker network.
# Usage (to run the node no. 1): ./start.sh 1
# Usage (to run the node no. 1): ./cluster-start.sh 1
# Validate the node count arg.
if [ -n "$1" ] && [ "$1" -eq "$1" ] 2>/dev/null; then

28
test/local-cluster/rundir.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
# Runs the specified contract directory with hpcore docker image.
# This script assumes you already have the hpcore docker image and 'hpnet' virtual docker network.
# Usage: ./rundir.sh 1
# Validate the node count arg.
if [ -z "$1" ]; then
echo "Error: Please provide contract directory to run."
exit 1
else
echo "Starting docker container..."
fi
dir=$(realpath $1)
dirname=$(basename $dir)
n=$1
let pubport=8080
# Mount the directory $dir into hpcore docker container and run.
# We specify --network=hpnet so all nodes will communicate via 'hpnet' docker virtual network.
# We specify --name for each node so it will be the virtual dns name for each node.
docker run --rm -t -i --network=hpnet --name=hp_$dirname \
-p ${pubport}:${pubport} \
--device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \
--mount type=bind,source=$dir,target=/contract \
hpcore:latest run /contract