Skip to content

Commit 7d1bb40

Browse files
committed
[Fluid] Remove unused methods in fluid class
1 parent 15db6b9 commit 7d1bb40

File tree

2 files changed

+2
-109
lines changed

2 files changed

+2
-109
lines changed

src/fluid/fluid.cpp

+1-102
Original file line numberDiff line numberDiff line change
@@ -96,34 +96,6 @@ std::vector<std::string> InitialiseAddresses()
9696
return params.InitialiseAddresses();
9797
}
9898

99-
/** Checks if any given address is a current master key (invoked by RPC) */
100-
bool CFluid::IsGivenKeyMaster(const CDynamicAddress& inputKey)
101-
{
102-
if (!inputKey.IsValid()) {
103-
return false;
104-
}
105-
106-
std::vector<std::string> fluidSovereigns;
107-
GetLastBlockIndex(chainActive.Tip());
108-
CBlockIndex* pindex = chainActive.Tip();
109-
110-
if (pindex != NULL) {
111-
//TODO fluid
112-
fluidSovereigns = InitialiseAddresses(); //pindex->fluidParams.fluidSovereigns;
113-
}
114-
115-
else
116-
fluidSovereigns = InitialiseAddresses();
117-
118-
for (const std::string& strAddress : fluidSovereigns) {
119-
CDynamicAddress attemptKey(strAddress);
120-
if (attemptKey.IsValid() && inputKey == attemptKey)
121-
return true;
122-
}
123-
124-
return false;
125-
}
126-
12799
std::vector<std::string> CFluidParameters::InitialiseAddresses()
128100
{
129101
std::vector<std::string> initialSovereignAddresses;
@@ -518,7 +490,7 @@ bool CFluid::ParseMintKey(const int64_t& nTime, CDynamicAddress& destination, CA
518490
return true;
519491
}
520492

521-
static bool GetFluidBlock(const CBlockIndex* pblockindex, CBlock& block)
493+
bool GetFluidBlock(const CBlockIndex* pblockindex, CBlock& block)
522494
{
523495
if (pblockindex != nullptr) {
524496
// Check for invalid block position and file.
@@ -554,56 +526,6 @@ bool CFluid::GetMintingInstructions(const CBlockIndex* pblockindex, CDynamicAddr
554526
return false;
555527
}
556528

557-
bool CFluid::GetProofOverrideRequest(const CBlockIndex* pblockindex, CAmount& coinAmount)
558-
{
559-
CBlock block;
560-
if (GetFluidBlock(pblockindex, block)) {
561-
for (const CTransactionRef& tx : block.vtx) {
562-
for (const CTxOut& txout : tx->vout) {
563-
if (txout.scriptPubKey.IsProtocolInstruction(MINING_MODIFY_TX)) {
564-
std::string message;
565-
if (CheckIfQuorumExists(ScriptToAsmStr(txout.scriptPubKey), message))
566-
return GenericParseNumber(ScriptToAsmStr(txout.scriptPubKey), block.nTime, coinAmount);
567-
}
568-
}
569-
}
570-
}
571-
return false;
572-
}
573-
574-
bool CFluid::GetDynodeOverrideRequest(const CBlockIndex* pblockindex, CAmount& coinAmount)
575-
{
576-
CBlock block;
577-
if (GetFluidBlock(pblockindex, block)) {
578-
for (const CTransactionRef& tx : block.vtx) {
579-
for (const CTxOut& txout : tx->vout) {
580-
if (txout.scriptPubKey.IsProtocolInstruction(DYNODE_MODFIY_TX)) {
581-
std::string message;
582-
if (CheckIfQuorumExists(ScriptToAsmStr(txout.scriptPubKey), message))
583-
return GenericParseNumber(ScriptToAsmStr(txout.scriptPubKey), block.nTime, coinAmount);
584-
}
585-
}
586-
}
587-
}
588-
return false;
589-
}
590-
591-
void CFluid::AddFluidTransactionsToRecord(const CBlockIndex* pblockindex, std::vector<std::string>& transactionRecord)
592-
{
593-
CBlock block;
594-
if (GetFluidBlock(pblockindex, block)) {
595-
for (const CTransactionRef& tx : block.vtx) {
596-
for (const CTxOut& txout : tx->vout) {
597-
if (IsTransactionFluid(txout.scriptPubKey)) {
598-
if (!InsertTransactionToRecord(txout.scriptPubKey, transactionRecord)) {
599-
LogPrintf("AddFluidTransactionsToRecord(): Script Database Entry: %s , FAILED!\n", ScriptToAsmStr(txout.scriptPubKey));
600-
}
601-
}
602-
}
603-
}
604-
}
605-
}
606-
607529
/* Check if transaction exists in record */
608530
bool CFluid::CheckTransactionInRecord(const CScript& fluidInstruction, CBlockIndex* pindex)
609531
{
@@ -627,29 +549,6 @@ bool CFluid::CheckTransactionInRecord(const CScript& fluidInstruction, CBlockInd
627549
return false;
628550
}
629551

630-
/* Insertion of transaction script to record */
631-
bool CFluid::InsertTransactionToRecord(const CScript& fluidInstruction, std::vector<std::string>& transactionRecord)
632-
{
633-
std::string verificationString;
634-
635-
if (IsTransactionFluid(fluidInstruction)) {
636-
verificationString = ScriptToAsmStr(fluidInstruction);
637-
638-
std::string message;
639-
if (CheckIfQuorumExists(verificationString, message)) {
640-
for (const std::string& existingRecord : transactionRecord) {
641-
if (existingRecord == verificationString) {
642-
return false;
643-
}
644-
}
645-
transactionRecord.push_back(verificationString);
646-
return true;
647-
}
648-
}
649-
650-
return false;
651-
}
652-
653552
CAmount GetStandardPoWBlockPayment(const int nHeight)
654553
{
655554
if (nHeight == 1) {

src/fluid/fluid.h

+1-7
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ std::vector<std::string> InitialiseAddresses();
4646
class CFluid : public CFluidParameters, public COperations
4747
{
4848
public:
49-
void AddFluidTransactionsToRecord(const CBlockIndex* pblockindex, std::vector<std::string>& transactionRecord);
5049
void ReplaceFluidSovereigns(const CBlockHeader& blockHeader, std::vector<std::string>& fluidSovereigns);
5150

52-
bool IsGivenKeyMaster(const CDynamicAddress& inputKey);
53-
5451
bool CheckFluidOperationScript(const CScript& fluidScriptPubKey, const int64_t& timeStamp, std::string& errorMessage, const bool fSkipTimeStampCheck = false);
5552
bool CheckIfExistsInMemPool(const CTxMemPool& pool, const CScript& fluidScriptPubKey, std::string& errorMessage);
5653
bool CheckIfQuorumExists(const std::string& consentToken, std::string& message, const bool individual = false);
@@ -66,16 +63,12 @@ class CFluid : public CFluidParameters, public COperations
6663
bool ProcessFluidToken(const std::string& consentToken, std::vector<std::string>& ptrs, const int& strVecNo);
6764

6865
bool GetMintingInstructions(const CBlockIndex* pblockindex, CDynamicAddress& toMintAddress, CAmount& mintAmount);
69-
bool GetProofOverrideRequest(const CBlockIndex* pblockindex, CAmount& howMuch);
70-
bool GetDynodeOverrideRequest(const CBlockIndex* pblockindex, CAmount& howMuch);
71-
7266
bool ValidationProcesses(CValidationState& state, const CScript& txOut, const CAmount& txValue);
7367

7468
bool CheckTransactionToBlock(const CTransaction& transaction, const CBlockHeader& blockHeader);
7569
bool CheckTransactionToBlock(const CTransaction& transaction, const uint256 hash);
7670

7771
bool ProvisionalCheckTransaction(const CTransaction& transaction);
78-
bool InsertTransactionToRecord(const CScript& fluidInstruction, std::vector<std::string>& transactionRecord);
7972
CDynamicAddress GetAddressFromDigestSignature(const std::string& digestSignature, const std::string& messageTokenKey);
8073
bool CheckAccountBanScript(const CScript& fluidScript, const uint256& txHashId, const unsigned int& nHeight, std::string& strErrorMessage);
8174

@@ -93,6 +86,7 @@ int GetFluidOpCode(const CScript& fluidScript);
9386
std::vector<unsigned char> CharVectorFromString(const std::string& str);
9487
std::string StringFromCharVector(const std::vector<unsigned char>& vch);
9588
std::vector<unsigned char> FluidScriptToCharVector(const CScript& fluidScript);
89+
bool GetFluidBlock(const CBlockIndex* pblockindex, CBlock& block);
9690

9791
extern CFluid fluid;
9892

0 commit comments

Comments
 (0)