Skip to content

Commit

Permalink
Port rpc node
Browse files Browse the repository at this point in the history
  • Loading branch information
timemarkovqtum committed Mar 4, 2024
1 parent acbb772 commit d18516e
Show file tree
Hide file tree
Showing 10 changed files with 773 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,10 @@ BITCOIN_CORE_H = \
zmq/zmqrpc.h \
zmq/zmqutil.h \
qtum/posutils.h \
qtum/qtumstate.h \
qtum/qtumtransaction.h \
qtum/qtumDGP.h \
qtum/storageresults.h \
qtum/qtumutils.h \
qtum/qtumtoken.h \
qtum/qtumledger.h \
Expand Down Expand Up @@ -489,6 +492,8 @@ libbitcoin_node_a_SOURCES = \
validation.cpp \
validationinterface.cpp \
versionbits.cpp \
qtum/qtumstate.cpp \
qtum/storageresults.cpp \
qtum/qtumledger.cpp \
$(BITCOIN_CORE_H)

Expand Down Expand Up @@ -733,6 +738,7 @@ libbitcoin_common_a_SOURCES = \
script/solver.cpp \
warnings.cpp \
qtum/qtumutils.cpp \
qtum/qtumDGP.cpp \
qtum/qtumtoken.cpp \
qtum/delegationutils.cpp \
util/contractabi.cpp \
Expand Down
38 changes: 38 additions & 0 deletions src/key_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,41 @@ bool IsValidDestinationString(const std::string& str)
{
return IsValidDestinationString(str, Params());
}
bool DecodeIndexKey(const std::string &str, uint256 &hashBytes, int &type)
{
CTxDestination dest = DecodeDestination(str);
if (IsValidDestination(dest))
{
if(std::holds_alternative<PKHash>(dest))
{
PKHash keyID = std::get<PKHash>(dest);
memcpy(hashBytes.data(), &keyID, 20);
type = 1;
return true;
}

if(std::holds_alternative<ScriptHash>(dest))
{
ScriptHash scriptID = std::get<ScriptHash>(dest);
memcpy(hashBytes.data(), &scriptID, 20);
type = 2;
return true;
}

if (std::holds_alternative<WitnessV0ScriptHash>(dest)) {
WitnessV0ScriptHash witnessV0ScriptID = std::get<WitnessV0ScriptHash>(dest);
memcpy(hashBytes.data(), &witnessV0ScriptID, 32);
type = 3;
return true;
}

if (std::holds_alternative<WitnessV0KeyHash>(dest)) {
const WitnessV0KeyHash witnessV0KeyID = std::get<WitnessV0KeyHash>(dest);
memcpy(hashBytes.data(), &witnessV0KeyID, 20);
type = 4;
return true;
}
}

return false;
}
1 change: 1 addition & 0 deletions src/key_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ CTxDestination DecodeDestination(const std::string& str);
CTxDestination DecodeDestination(const std::string& str, std::string& error_msg, std::vector<int>* error_locations = nullptr);
bool IsValidDestinationString(const std::string& str);
bool IsValidDestinationString(const std::string& str, const CChainParams& params);
bool DecodeIndexKey(const std::string& str, uint256& hashBytes, int& type);

#endif // BITCOIN_KEY_IO_H
2 changes: 1 addition & 1 deletion src/qtum/qtumstate.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sstream>
#include <util/system.h>
#include <common/system.h>
#include <validation.h>
#include <chainparams.h>
#include <script/script.h>
Expand Down
1 change: 1 addition & 0 deletions src/qtum/storageresults.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <qtum/storageresults.h>
#include <util/convert.h>
#include <logging.h>

StorageResults::StorageResults(std::string const& _path){
path = _path + "/resultsDB";
Expand Down
2 changes: 1 addition & 1 deletion src/qtum/storageresults.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <libethereum/State.h>
#include <libethereum/Transaction.h>
#include <leveldb/db.h>
#include <util/system.h>
#include <common/system.h>

using logEntriesSerialize = std::vector<std::pair<dev::Address, std::pair<dev::h256s, dev::bytes>>>;

Expand Down
Loading

0 comments on commit d18516e

Please sign in to comment.