Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.0-dev' into 2.0-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-schmidtke committed Sep 16, 2019
2 parents 0365795 + 6c2364f commit 900d1c0
Show file tree
Hide file tree
Showing 41 changed files with 1,404 additions and 130 deletions.
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ libbitcoin_server_a_SOURCES = \
rpc/rpcmisc.cpp \
rpc/rpcnet.cpp \
rpc/rpcrawtransaction.cpp \
rpc/rpcfeeds.cpp \
rpc/rpcserver.cpp \
script/sigcache.cpp \
utils/timedata.cpp \
Expand Down
51 changes: 51 additions & 0 deletions src/chainparams/params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2435,3 +2435,54 @@ int mc_Features::License20010()
}


int mc_Features::ExtendedEntityDetails()
{
int ret=0;
if(mc_gState->m_NetworkParams->IsProtocolMultichain() == 0)
{
return 0;
}
int protocol=mc_gState->m_NetworkParams->ProtocolVersion();

if(protocol)
{
if(protocol >= 20011)
{
ret=1;
}
}

return ret;

}
int mc_Features::FixedSpendingBigScripts()
{
int ret=0;

if(mc_gState->m_NetworkParams->IsProtocolMultichain() == 0)
{
return 1;
}

int protocol=mc_gState->m_NetworkParams->ProtocolVersion();

if(protocol)
{
if(protocol < 20000)
{
if(protocol >= 10012)
{
ret=1;
}
}
else
{
if(protocol >= 20011)
{
ret=1;
}
}
}

return ret;
}
2 changes: 2 additions & 0 deletions src/chainparams/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ typedef struct mc_Features
int SaltedChunks();
int FixedIn20010();
int License20010();
int ExtendedEntityDetails();
int FixedSpendingBigScripts();
} mc_Features;

typedef struct mc_BlockHeaderInfo
Expand Down
136 changes: 135 additions & 1 deletion src/community/community.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ void mc_EnterpriseFeatures::Destroy()
Zero();
}

int mc_EnterpriseFeatures::Prepare()
{
return MC_ERR_NOERROR;
}

int mc_EnterpriseFeatures::Initialize(const char *name,uint32_t mode)
{

Expand Down Expand Up @@ -86,12 +91,67 @@ Value mc_EnterpriseFeatures::STR_RPCPurgePublishedItems(const Array& params)
return Value::null;
}


int mc_EnterpriseFeatures::STR_RemoveDataFromFile(int fHan, uint32_t from, uint32_t size, uint32_t mode)
{
return MC_ERR_NOERROR;
}

Value mc_EnterpriseFeatures::FED_RPCCreateFeed(const Array& params)
{
return Value::null;
}

Value mc_EnterpriseFeatures::FED_RPCSuspendFeed(const Array& params)
{
return Value::null;
}

Value mc_EnterpriseFeatures::FED_RPCDeleteFeed(const Array& params)
{
return Value::null;
}

Value mc_EnterpriseFeatures::FED_RPCRescanFeed(const Array& params)
{
return Value::null;
}

Value mc_EnterpriseFeatures::FED_RPCAddFeedStreams(const Array& params)
{
return Value::null;
}

Value mc_EnterpriseFeatures::FED_RPCRemoveFeedStreams(const Array& params)
{
return Value::null;
}

Value mc_EnterpriseFeatures::FED_RPCAddFeedBlocks(const Array& params)
{
return Value::null;
}

Value mc_EnterpriseFeatures::FED_RPCRemoveFeedBlocks(const Array& params)
{
return Value::null;
}

Value mc_EnterpriseFeatures::FED_RPCPurgeFeedFile(const Array& params)
{
return Value::null;
}

Value mc_EnterpriseFeatures::FED_RPCListFeeds(const Array& params)
{
return Value::null;
}

int mc_EnterpriseFeatures::FED_EventTx(const CTransaction& tx,int block,CDiskTxPos* block_pos,uint32_t block_tx_index,uint256 block_hash,uint32_t block_timestamp)
{
return MC_ERR_NOERROR;
}


bool mc_EnterpriseFeatures::OFF_ProcessChunkRequest(unsigned char *ptrStart,unsigned char *ptrEnd,vector<unsigned char>* payload_response,vector<unsigned char>* payload_relay,
map<uint160,int>& mapReadPermissionedStreams,string& strError)
{
Expand Down Expand Up @@ -181,6 +241,76 @@ int mc_EnterpriseFeatures::WLT_NoRetrieve(mc_TxEntity *entity)
return 0;
}

bool mc_EnterpriseFeatures::NET_ProcessHandshakeData(CNode* pfrom, std::string sENTData,bool fIsVerackack)
{
return true;
}

std::vector<unsigned char> mc_EnterpriseFeatures::NET_PushHandshakeData(CNode* pfrom, bool fIsVerackack)
{
vector<unsigned char> result;
return result;
}

bool mc_EnterpriseFeatures::NET_FinalizeHandshake(CNode* pfrom)
{
return true;
}


void mc_EnterpriseFeatures::NET_FreeNodeData(void *pNodeData)
{

}

bool mc_EnterpriseFeatures::NET_IsEncrypted(CNode* pfrom)
{
return false;
}

bool mc_EnterpriseFeatures::NET_IsFinalized(CNode* pfrom)
{
return true;
}


int mc_EnterpriseFeatures::NET_ReadHeader(void *pNodeData,CNetMessage& msg,const char *pch,unsigned int nBytes)
{
return -1;
}

void mc_EnterpriseFeatures::NET_ProcessMsgData(void *pNodeData,CNetMessage& msg)
{

}

bool mc_EnterpriseFeatures::NET_PushMsg(void *pNodeData,CDataStream& ssSend)
{
return true;
}

int mc_EnterpriseFeatures::NET_StoreInCache(void *pNodeData,CNetMessage& msg,const char *pch,unsigned int nBytes)
{
return 0;
}

bool mc_EnterpriseFeatures::NET_RestoreFromCache(CNode* pfrom)
{
return true;
}

void mc_EnterpriseFeatures::NET_CheckConnections()
{

}

uint64_t mc_EnterpriseFeatures::NET_Services()
{
return 0;
}



string mc_EnterpriseFeatures::ENT_Edition()
{
return "Community";
Expand Down Expand Up @@ -296,4 +426,8 @@ Value mc_EnterpriseFeatures::LIC_RPCTakeLicense(const Array& params)
return Value::null;
}

Value mc_EnterpriseFeatures::LIC_RPCImportLicenseRequest(const Array& params)
{
return Value::null;
}

31 changes: 31 additions & 0 deletions src/community/community.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#define MC_EFT_STREAM_READ_RESTRICTED_DELIVER 0x0000000000004000
#define MC_EFT_NETWORK_SIGNED_RECEIVE 0x0000000000010000
#define MC_EFT_NETWORK_SIGNED_SEND 0x0000000000020000
#define MC_EFT_NETWORK_ENCRYPTED_CONNECTIONS 0x0000000000040000
#define MC_EFT_FEEDS 0x0000000000100000

#define MC_EFT_ALL 0xFFFFFFFFFFFFFFFF


Expand All @@ -36,6 +39,7 @@ typedef struct mc_EnterpriseFeatures

void Zero();
void Destroy();
int Prepare();
int Initialize(
const char *name, // Chain name
uint32_t mode); // Unused
Expand All @@ -55,6 +59,18 @@ typedef struct mc_EnterpriseFeatures
Value STR_RPCPurgePublishedItems(const Array& params);
int STR_RemoveDataFromFile(int fHan, uint32_t from, uint32_t size, uint32_t mode);

Value FED_RPCCreateFeed(const Array& params);
Value FED_RPCSuspendFeed(const Array& params);
Value FED_RPCDeleteFeed(const Array& params);
Value FED_RPCRescanFeed(const Array& params);
Value FED_RPCAddFeedStreams(const Array& params);
Value FED_RPCRemoveFeedStreams(const Array& params);
Value FED_RPCAddFeedBlocks(const Array& params);
Value FED_RPCRemoveFeedBlocks(const Array& params);
Value FED_RPCPurgeFeedFile(const Array& params);
Value FED_RPCListFeeds(const Array& params);
int FED_EventTx(const CTransaction& tx,int block,CDiskTxPos* block_pos,uint32_t block_tx_index,uint256 block_hash,uint32_t block_timestamp);

bool OFF_ProcessChunkRequest(unsigned char *ptrStart,unsigned char *ptrEnd,vector<unsigned char>* payload_response,vector<unsigned char>* payload_relay,
map<uint160,int>& mapReadPermissionedStreams,string& strError);
bool OFF_ProcessChunkResponse(mc_RelayRequest *request,mc_RelayResponse *response,map <int,int>* request_pairs,mc_ChunkCollector* collector,string& strError);
Expand All @@ -75,6 +91,20 @@ typedef struct mc_EnterpriseFeatures
int WLT_NoIndex(mc_TxEntity *entity);
int WLT_NoRetrieve(mc_TxEntity *entity);

bool NET_ProcessHandshakeData(CNode* pfrom, std::string sENTData,bool fIsVerackack);
std::vector<unsigned char> NET_PushHandshakeData(CNode* pfrom,bool fIsVerackack);
bool NET_FinalizeHandshake(CNode* pfrom);
void NET_FreeNodeData(void *pNodeData);
bool NET_IsEncrypted(CNode* pfrom);
bool NET_IsFinalized(CNode* pfrom);
int NET_ReadHeader(void *pNodeData,CNetMessage& msg,const char *pch,unsigned int nBytes);
void NET_ProcessMsgData(void *pNodeData,CNetMessage& msg);
int NET_StoreInCache(void *pNodeData,CNetMessage& msg,const char *pch,unsigned int nBytes);
bool NET_RestoreFromCache(CNode* pfrom);
bool NET_PushMsg(void *pNodeData,CDataStream& ssSend);
void NET_CheckConnections();
uint64_t NET_Services();

std::string ENT_Edition();
int ENT_EditionNumeric();
int ENT_BuildVersion();
Expand All @@ -98,6 +128,7 @@ typedef struct mc_EnterpriseFeatures
Value LIC_RPCListLicenseRequests(const Array& params);
Value LIC_RPCGetLicenseConfirmation(const Array& params);
Value LIC_RPCTakeLicense(const Array& params);
Value LIC_RPCImportLicenseRequest(const Array& params);


} mc_EnterpriseFeatures;
Expand Down
68 changes: 36 additions & 32 deletions src/community/license.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,42 @@
#define MC_LIC_DEFAULT_UNLOCKED_FEATURES 0xFFFFFFFFFFFFFFFF


#define MC_ENT_SPRM_LICENSE_CHAIN_PARAMS_HASH 0x01
#define MC_ENT_SPRM_LICENSE_PK_HASH_VERSION 0x08
#define MC_ENT_SPRM_LICENSE_SC_HASH_VERSION 0x09
#define MC_ENT_SPRM_LICENSE_CHECKSUM 0x0a
#define MC_ENT_SPRM_LICENSE_REQUEST_MIN 0x10
#define MC_ENT_SPRM_LICENSE_ADDRESS 0x10
#define MC_ENT_SPRM_LICENSE_ADDRESS_TYPE 0x11
#define MC_ENT_SPRM_LICENSE_MAC_ADDRESS 0x12
#define MC_ENT_SPRM_LICENSE_IP_ADDRESS 0x13
#define MC_ENT_SPRM_LICENSE_NODE_VERSION 0x14
#define MC_ENT_SPRM_LICENSE_PROTOCOL_VERSION 0x15
#define MC_ENT_SPRM_LICENSE_REQUEST_NONCE 0x1D
#define MC_ENT_SPRM_LICENSE_REQUEST_DETAILS 0x1E
#define MC_ENT_SPRM_LICENSE_REQUEST_MAX 0x1F
#define MC_ENT_SPRM_LICENSE_LICENSE_MIN 0x20
#define MC_ENT_SPRM_LICENSE_NONCE 0x20
#define MC_ENT_SPRM_LICENSE_START_TIME 0x21
#define MC_ENT_SPRM_LICENSE_END_TIME 0x22
#define MC_ENT_SPRM_LICENSE_UNLOCKED_FEATURES 0x23
#define MC_ENT_SPRM_LICENSE_FLAGS 0x24
#define MC_ENT_SPRM_LICENSE_PARAMS 0x25
#define MC_ENT_SPRM_LICENSE_DETAILS 0x2E
#define MC_ENT_SPRM_LICENSE_LICENSE_MAX 0x2F
#define MC_ENT_SPRM_LICENSE_ENCRYPTED_REQUEST 0x30
#define MC_ENT_SPRM_LICENSE_ORIGINAL_HASH 0x31
#define MC_ENT_SPRM_LICENSE_REQUEST_HASH 0x32
#define MC_ENT_SPRM_LICENSE_EKEY 0x56
#define MC_ENT_SPRM_LICENSE_EKEY_TYPE 0x57
#define MC_ENT_SPRM_LICENSE_TRANSFER_METHOD 0x58
#define MC_ENT_SPRM_LICENSE_COUNT 0x5D
#define MC_ENT_SPRM_LICENSE_CONFIRMATION_MIN 0x60
#define MC_ENT_SPRM_LICENSE_CONFIRMATION_MAX 0x6F
#define MC_ENT_SPRM_LICENSE_CHAIN_PARAMS_HASH 0x01
#define MC_ENT_SPRM_LICENSE_PK_HASH_VERSION 0x08
#define MC_ENT_SPRM_LICENSE_SC_HASH_VERSION 0x09
#define MC_ENT_SPRM_LICENSE_CHECKSUM 0x0a
#define MC_ENT_SPRM_LICENSE_REQUEST_MIN 0x10
#define MC_ENT_SPRM_LICENSE_ADDRESS 0x10
#define MC_ENT_SPRM_LICENSE_ADDRESS_TYPE 0x11
#define MC_ENT_SPRM_LICENSE_MAC_ADDRESS 0x12
#define MC_ENT_SPRM_LICENSE_IP_ADDRESS 0x13
#define MC_ENT_SPRM_LICENSE_NODE_VERSION 0x14
#define MC_ENT_SPRM_LICENSE_PROTOCOL_VERSION 0x15
#define MC_ENT_SPRM_LICENSE_REQUEST_NONCE 0x1D
#define MC_ENT_SPRM_LICENSE_REQUEST_DETAILS 0x1E
#define MC_ENT_SPRM_LICENSE_REQUEST_MAX 0x1F
#define MC_ENT_SPRM_LICENSE_LICENSE_MIN 0x20
#define MC_ENT_SPRM_LICENSE_NONCE 0x20
#define MC_ENT_SPRM_LICENSE_START_TIME 0x21
#define MC_ENT_SPRM_LICENSE_END_TIME 0x22
#define MC_ENT_SPRM_LICENSE_UNLOCKED_FEATURES 0x23
#define MC_ENT_SPRM_LICENSE_FLAGS 0x24
#define MC_ENT_SPRM_LICENSE_PARAMS 0x25
#define MC_ENT_SPRM_LICENSE_DETAILS 0x2E
#define MC_ENT_SPRM_LICENSE_LICENSE_MAX 0x2F
#define MC_ENT_SPRM_LICENSE_INFO_MIN 0x30
#define MC_ENT_SPRM_LICENSE_ENCRYPTED_REQUEST 0x30
#define MC_ENT_SPRM_LICENSE_ORIGINAL_HASH 0x31
#define MC_ENT_SPRM_LICENSE_REQUEST_HASH 0x32
#define MC_ENT_SPRM_LICENSE_EXTENSION_DELAY 0x33
#define MC_ENT_SPRM_LICENSE_EXTENSION_INTERVAL 0x34
#define MC_ENT_SPRM_LICENSE_INFO_MAX 0x3F
#define MC_ENT_SPRM_LICENSE_EKEY 0x56
#define MC_ENT_SPRM_LICENSE_EKEY_TYPE 0x57
#define MC_ENT_SPRM_LICENSE_TRANSFER_METHOD 0x58
#define MC_ENT_SPRM_LICENSE_COUNT 0x5D
#define MC_ENT_SPRM_LICENSE_CONFIRMATION_MIN 0x60
#define MC_ENT_SPRM_LICENSE_CONFIRMATION_MAX 0x6F


#define MC_ECF_LICENSE_PURCHASE_NO_ENCRYPTION 0x00000000
Expand Down
Loading

0 comments on commit 900d1c0

Please sign in to comment.