Skip to content

Commit

Permalink
Merge pull request #301 from pocketnetteam/consensus/reputation
Browse files Browse the repository at this point in the history
Consensus/reputation
  • Loading branch information
andyoknen authored Jun 21, 2022
2 parents e585e10 + 6d4ddda commit 490bd54
Show file tree
Hide file tree
Showing 44 changed files with 1,434 additions and 1,164 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)

set(_CLIENT_VERSION_MAJOR 0)
set(_CLIENT_VERSION_MINOR 20)
set(_CLIENT_VERSION_REVISION 22)
set(_CLIENT_VERSION_REVISION 23)
set(_CLIENT_VERSION_BUILD 0)
set(_CLIENT_VERSION_IS_RELEASE false)
set(_COPYRIGHT_YEAR 2022)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
<ClCompile Include="..\..\src\pocketdb\models\dto\Complain.hpp" />
<ClCompile Include="..\..\src\pocketdb\models\dto\Default.hpp" />
<ClCompile Include="..\..\src\pocketdb\models\dto\Post.hpp" />
<ClCompile Include="..\..\src\pocketdb\models\dto\ReturnDtoModels.hpp" />
<ClCompile Include="..\..\src\pocketdb\models\dto\DtoModels.hpp" />
<ClCompile Include="..\..\src\pocketdb\models\dto\ScoreComment.hpp" />
<ClCompile Include="..\..\src\pocketdb\models\dto\Subscribe.hpp" />
<ClCompile Include="..\..\src\pocketdb\models\dto\SubscribeCancel.hpp" />
Expand Down
6 changes: 3 additions & 3 deletions build_msvc/pocketcoin_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define CLIENT_VERSION_MINOR 20

/* Build revision */
#define CLIENT_VERSION_REVISION 22
#define CLIENT_VERSION_REVISION 23

/* Version Build */
#define CLIENT_VERSION_BUILD 0
Expand Down Expand Up @@ -346,7 +346,7 @@
#define PACKAGE_NAME "Pocketnet Core"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "Pocketnet Core 0.20.22"
#define PACKAGE_STRING "Pocketnet Core 0.20.23"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "pocketcoin"
Expand All @@ -355,7 +355,7 @@
#define PACKAGE_URL "https://github.com/pocketnetteam"

/* Define to the version of this package. */
#define PACKAGE_VERSION "0.20.22"
#define PACKAGE_VERSION "0.20.23"

/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 20)
define(_CLIENT_VERSION_REVISION, 22)
define(_CLIENT_VERSION_REVISION, 23)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2022)
Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ add_library(${POCKETDB}
pocketdb/models/base/TransactionOutput.h
pocketdb/models/base/SocialTransaction.h
pocketdb/models/base/Rating.h
pocketdb/models/base/ReturnDtoModels.h
pocketdb/models/base/DtoModels.h
pocketdb/models/dto/Default.h
pocketdb/models/dto/Coinbase.h
pocketdb/models/dto/Coinstake.h
Expand Down Expand Up @@ -785,6 +785,8 @@ add_library(${POCKETCOIN_SERVER}
pocketdb/repositories/CheckpointRepository.cpp
pocketdb/repositories/SystemRepository.h
pocketdb/repositories/SystemRepository.cpp
pocketdb/repositories/MigrationRepository.h
pocketdb/repositories/MigrationRepository.cpp
pocketdb/repositories/web/NotifierRepository.h
pocketdb/repositories/web/NotifierRepository.cpp
pocketdb/repositories/web/WebRepository.h
Expand Down
4 changes: 3 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ POCKETDB_H = \
pocketdb/repositories/RatingsRepository.h \
pocketdb/repositories/CheckpointRepository.h \
pocketdb/repositories/SystemRepository.h \
pocketdb/repositories/MigrationRepository.h \
pocketdb/repositories/web/WebRepository.h \
pocketdb/repositories/web/WebRpcRepository.h \
pocketdb/repositories/web/NotifierRepository.h \
Expand Down Expand Up @@ -175,7 +176,7 @@ POCKETDB_H = \
pocketdb/models/base/SocialTransaction.h \
pocketdb/models/base/Rating.h \
pocketdb/models/base/Payload.h \
pocketdb/models/base/ReturnDtoModels.h \
pocketdb/models/base/DtoModels.h \
\
pocketdb/models/dto/Default.h \
pocketdb/models/dto/Coinbase.h \
Expand Down Expand Up @@ -228,6 +229,7 @@ POCKETDB_CPP = \
pocketdb/repositories/RatingsRepository.cpp \
pocketdb/repositories/CheckpointRepository.cpp \
pocketdb/repositories/SystemRepository.cpp \
pocketdb/repositories/MigrationRepository.cpp \
pocketdb/repositories/web/WebRepository.cpp \
pocketdb/repositories/web/WebRpcRepository.cpp \
pocketdb/repositories/web/NotifierRepository.cpp \
Expand Down
12 changes: 11 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ void ShutdownPocketServices()
PocketDb::RatingsRepoInst.Destroy();
PocketDb::ConsensusRepoInst.Destroy();
PocketDb::NotifierRepoInst.Destroy();
PocketDb::MigrationRepoInst.Destroy();

PocketDb::SQLiteDbInst.DetachDatabase("web");
PocketDb::SQLiteDbInst.Close();
Expand Down Expand Up @@ -849,7 +850,10 @@ static void ThreadImport(std::vector<fs::path> vImportFiles)
int i = (int)gArgs.GetArg("-reindex-start", 0);
LogPrintf("Start indexing pocketnet part at height %d\n", i);

PocketServices::ChainPostProcessing::Rollback(i);
if (i == 0)
PocketDb::ChainRepoInst.ClearDatabase();
else
PocketServices::ChainPostProcessing::Rollback(i);

while (i <= chainActive.Height() && !ShutdownRequested())
{
Expand Down Expand Up @@ -1714,6 +1718,12 @@ bool AppInitMain()
if (!gArgs.GetBoolArg("-withoutweb", false))
PocketServices::WebPostProcessorInst.Start(threadGroup);

if (ShutdownRequested())
{
LogPrintf("Shutdown requested. Exiting.\n");
return false;
}

// ********************************************************* Step 4b: Additional settings

if (gArgs.GetArg("-reindex", 0) == 4)
Expand Down
2 changes: 2 additions & 0 deletions src/pocketdb/SQLiteConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace PocketDb
ExplorerRepoInst = make_shared<ExplorerRepository>(*SQLiteDbInst);
SearchRepoInst = make_shared<SearchRepository>(*SQLiteDbInst);
TransactionRepoInst = make_shared<TransactionRepository>(*SQLiteDbInst);
ConsensusRepoInst = make_shared<ConsensusRepository>(*SQLiteDbInst);
}

SQLiteConnection::~SQLiteConnection()
Expand All @@ -28,6 +29,7 @@ namespace PocketDb
ExplorerRepoInst->Destroy();
SearchRepoInst->Destroy();
TransactionRepoInst->Destroy();
ConsensusRepoInst->Destroy();

SQLiteDbInst->DetachDatabase("web");
SQLiteDbInst->Close();
Expand Down
2 changes: 2 additions & 0 deletions src/pocketdb/SQLiteConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "pocketdb/repositories/web/WebRpcRepository.h"
#include "pocketdb/repositories/web/ExplorerRepository.h"
#include "pocketdb/repositories/web/SearchRepository.h"
#include "pocketdb/repositories/ConsensusRepository.h"
#include "pocketdb/repositories/TransactionRepository.h"

#include "pocketdb/web/PocketFrontend.h"
Expand All @@ -34,6 +35,7 @@ namespace PocketDb
ExplorerRepositoryRef ExplorerRepoInst;
SearchRepositoryRef SearchRepoInst;
TransactionRepositoryRef TransactionRepoInst;
ConsensusRepositoryRef ConsensusRepoInst;

};

Expand Down
19 changes: 19 additions & 0 deletions src/pocketdb/SQLiteDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,25 @@ namespace PocketDb
ConsensusRepoInst.Init();
NotifierRepoInst.Init();
SystemRepoInst.Init();
MigrationRepoInst.Init();

// Execute migration scripts
if (gArgs.GetArg("-reindex", 0) == 0)
{
if (!MigrationRepoInst.SplitLikers())
{
LogPrintf("SQLDB Migration: SplitLikers completed.\n");
StartShutdown();
return;
}

if (!MigrationRepoInst.AccumulateLikers())
{
LogPrintf("SQLDB Migration: AccumulateLikers completed.\n");
StartShutdown();
return;
}
}

// Open, create structure and close `web` db
PocketDbMigrationRef webDbMigration = std::make_shared<PocketDbWebMigration>();
Expand Down
Loading

0 comments on commit 490bd54

Please sign in to comment.