mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Changes for unstable consensus. (#272)
* Return empty hash when set or vector is empty in crypto. * Changing <operator in sequence_hash struct. * Fixing vm script and allowing only single sync target per vpath. * Making vm cluster log level to debug. * Increasing hpws max message size and fixing lcl mode in vm cluster scripts. * lcl block fix.
This commit is contained in:
committed by
GitHub
parent
b7e9301797
commit
7cec6d01c1
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace comm
|
||||
{
|
||||
constexpr uint32_t DEFAULT_MAX_MSG_SIZE = 4 * 1024 * 1024;
|
||||
constexpr uint32_t DEFAULT_MAX_MSG_SIZE = 5 * 1024 * 1024;
|
||||
constexpr uint64_t DEFAULT_MAX_CONNECTIONS = 99999;
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -161,6 +161,11 @@ namespace crypto
|
||||
std::string hash;
|
||||
hash.resize(BLAKE3_OUT_LEN);
|
||||
|
||||
if (sw_vect.empty())
|
||||
{
|
||||
return hash;
|
||||
}
|
||||
|
||||
// Init stream hashing.
|
||||
blake3_hasher hasher;
|
||||
blake3_hasher_init(&hasher);
|
||||
@@ -183,6 +188,11 @@ namespace crypto
|
||||
std::string hash;
|
||||
hash.resize(BLAKE3_OUT_LEN);
|
||||
|
||||
if (sw_set.empty())
|
||||
{
|
||||
return hash;
|
||||
}
|
||||
|
||||
// Init stream hashing.
|
||||
blake3_hasher hasher;
|
||||
blake3_hasher_init(&hasher);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace p2p
|
||||
|
||||
bool operator<(const sequence_hash &seq_hash) const
|
||||
{
|
||||
return seq_no < seq_hash.seq_no || hash < seq_hash.hash;
|
||||
return (seq_no == seq_hash.seq_no) ? hash < seq_hash.hash : seq_no < seq_hash.seq_no;
|
||||
}
|
||||
|
||||
const std::string to_string()
|
||||
|
||||
@@ -36,9 +36,9 @@ else
|
||||
fi
|
||||
|
||||
contconfig=$(jq -r ".contracts[] | select(.name == \"${CONTRACT}\") | .config" $conf)
|
||||
if [ "$contconfig" = "" ]; then
|
||||
if [ "$contconfig" = "" ] || [ "$contconfig" = "{}" ]; then
|
||||
# Apply default config.
|
||||
contconfig="{user: {'port': 8080 }, mesh:{ 'port': 22860}, 'contract': {'roundtime': 2000 }, 'log':{'loglevel': 'dbg', 'loggers':['console','file']}}"
|
||||
contconfig="{\"user\": {\"port\": 8080}, \"mesh\":{ \"port\": 22860}, \"contract\": {\"roundtime\": 2000 }, \"log\":{\"loglevel\": \"dbg\", \"loggers\":[\"console\",\"file\"]}}"
|
||||
fi
|
||||
|
||||
vmpass=$(jq -r '.vmpass' $conf)
|
||||
@@ -237,11 +237,12 @@ if [ $mode = "ssl" ]; then
|
||||
fi
|
||||
|
||||
if [ $mode = "lcl" ]; then
|
||||
command="$contdir/lcl.sh"
|
||||
for (( i=0; i<$vmcount; i++ ))
|
||||
do
|
||||
vmaddr=${vmaddrs[i]}
|
||||
let nodeid=$i+1
|
||||
echo "node$nodeid:" $(sshpass -p $vmpass ssh $vmuser@$vmaddr ls -v $contdir/hist | tail -1) &
|
||||
echo "node"$nodeid":" $(sshpass -p $vmpass ssh $vmuser@$vmaddr $command) &
|
||||
done
|
||||
wait
|
||||
exit 0
|
||||
|
||||
@@ -13,6 +13,10 @@ then
|
||||
sudo swapon /swapfile
|
||||
fi
|
||||
|
||||
# Getting updates if any
|
||||
echo "Checking for updates..."
|
||||
sudo apt-get update
|
||||
|
||||
if [ -x "$(command -v node)" ]; then
|
||||
echo "NodeJs already installed."
|
||||
else
|
||||
@@ -33,6 +37,14 @@ else
|
||||
sudo cp $basedir/hpfiles/bin/fusermount3 /usr/local/bin/
|
||||
fi
|
||||
|
||||
if [ -x "$(command -v sqlite3)" ]; then
|
||||
echo "SQLite already installed."
|
||||
else
|
||||
echo "Installing SQLite..."
|
||||
sudo apt-get install -y sqlite3 libsqlite3-dev
|
||||
fi
|
||||
|
||||
|
||||
# Remove existing contract dir.
|
||||
sudo rm -r $contdir > /dev/null 2>&1
|
||||
|
||||
@@ -70,6 +82,11 @@ if [ $mode = "new" ] || [ $mode = "reconfig" ]; then
|
||||
echo "sudo kill \$($contdir/getpid.sh hpcore hpfs hpws)" > $contdir/kill.sh
|
||||
sudo chmod +x $contdir/kill.sh
|
||||
|
||||
# Create lcl.sh script
|
||||
echo "max_shard_no=\$(ls -v $contdir/ledger_fs/seed/primary/ | tail -2 | head -1)" > $contdir/lcl.sh
|
||||
echo "echo \"select seq_no, ledger_hash from ledger order by seq_no DESC limit 1;\" | sqlite3 $contdir/ledger_fs/seed/primary/\$max_shard_no/ledger.sqlite" >> $contdir/lcl.sh
|
||||
sudo chmod +x $contdir/lcl.sh
|
||||
|
||||
# Configure .screenrc
|
||||
pushd $contdir > /dev/null 2>&1
|
||||
echo "chdir $contdir" >> hp.screenrc
|
||||
|
||||
Reference in New Issue
Block a user