mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Split and refactor ProofOfWork
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
#include "NicknameState.h"
|
||||
#include "Offer.h"
|
||||
#include "PFRequest.h"
|
||||
#include "ProofOfWork.h"
|
||||
|
||||
SETUP_LOG (RPCHandler)
|
||||
|
||||
@@ -889,7 +888,7 @@ Json::Value RPCHandler::doProofCreate(Json::Value jvRequest, int& cost, ScopedLo
|
||||
|
||||
if (jvRequest.isMember("difficulty") || jvRequest.isMember("secret"))
|
||||
{
|
||||
ProofOfWorkGenerator pgGen;
|
||||
ProofOfWorkFactory pgGen;
|
||||
|
||||
if (jvRequest.isMember("difficulty"))
|
||||
{
|
||||
@@ -913,7 +912,7 @@ Json::Value RPCHandler::doProofCreate(Json::Value jvRequest, int& cost, ScopedLo
|
||||
jvResult["token"] = pgGen.getProof().getToken();
|
||||
jvResult["secret"] = pgGen.getSecret().GetHex();
|
||||
} else {
|
||||
jvResult["token"] = theApp->getPowGen().getProof().getToken();
|
||||
jvResult["token"] = theApp->getProofOfWorkFactory().getProof().getToken();
|
||||
}
|
||||
|
||||
return jvResult;
|
||||
@@ -971,7 +970,7 @@ Json::Value RPCHandler::doProofVerify(Json::Value jvRequest, int& cost, ScopedLo
|
||||
POWResult prResult;
|
||||
if (jvRequest.isMember("difficulty") || jvRequest.isMember("secret"))
|
||||
{
|
||||
ProofOfWorkGenerator pgGen;
|
||||
ProofOfWorkFactory pgGen;
|
||||
|
||||
if (jvRequest.isMember("difficulty"))
|
||||
{
|
||||
@@ -999,7 +998,7 @@ Json::Value RPCHandler::doProofVerify(Json::Value jvRequest, int& cost, ScopedLo
|
||||
else
|
||||
{
|
||||
// XXX Proof should not be marked as used from this
|
||||
prResult = theApp->getPowGen().checkProof(strToken, uSolution);
|
||||
prResult = theApp->getProofOfWorkFactory().checkProof(strToken, uSolution);
|
||||
}
|
||||
|
||||
std::string sToken;
|
||||
|
||||
Reference in New Issue
Block a user