Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fireice-uk committed Mar 20, 2024
1 parent c058b8e commit 184fcb2
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CryptoNoteConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ namespace cn

// This defines the minimum P2P version required for lite blocks propogation
const uint8_t P2P_LITE_BLOCKS_PROPOGATION_VERSION = 3;
const uint8_t P2P_CHECKPOINT_LIST_VERSION = 3;

const size_t P2P_LOCAL_WHITE_PEERLIST_LIMIT = 1000;
const size_t P2P_LOCAL_GRAY_PEERLIST_LIMIT = 5000;
Expand Down
36 changes: 36 additions & 0 deletions src/CryptoNoteProtocol/CryptoNoteProtocolDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ namespace cn
typedef NOTIFY_NEW_LITE_BLOCK_request request;
};

/************************************************************************/
/* */
/************************************************************************/
struct NOTIFY_MISSING_TXS_request
{
crypto::Hash blockHash;
Expand All @@ -244,5 +247,38 @@ namespace cn
const static int ID = BC_COMMANDS_POOL_BASE + 10;
typedef NOTIFY_MISSING_TXS_request request;
};

/************************************************************************/
/* */
/************************************************************************/
struct NOTIFY_REQUEST_CHECKPOINT_LIST_request
{

void serialize(ISerializer &s)
{

}
};

struct NOTIFY_REQUEST_CHECKPOINT_LIST
{
const static int ID = BC_COMMANDS_POOL_BASE + 11;
typedef NOTIFY_REQUEST_CHECKPOINT_LIST_request request;
};

struct NOTIFY_RESPONSE_CHECKPOINT_LIST_request
{

void serialize(ISerializer &s)
{

}
};

struct NOTIFY_RESPONSE_CHECKPOINT_LIST
{
const static int ID = BC_COMMANDS_POOL_BASE + 12;
typedef NOTIFY_RESPONSE_CHECKPOINT_LIST_request request;
};
} // namespace cn

15 changes: 15 additions & 0 deletions src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ bool CryptoNoteProtocolHandler::process_payload_sync_data(const CORE_SYNC_DATA &
{
m_peersCount++;
m_observerManager.notify(&ICryptoNoteProtocolObserver::peerCountUpdated, m_peersCount.load());

// only if checkpoint is loaded
NOTIFY_REQUEST_CHECKPOINT_LIST::request req;
if (!post_notify<NOTIFY_REQUEST_CHECKPOINT_LIST>(*m_p2p, req, context))
return false;
}

return true;
Expand Down Expand Up @@ -259,6 +264,8 @@ int CryptoNoteProtocolHandler::handleCommand(bool is_notify, int command, const
HANDLE_NOTIFY(NOTIFY_NEW_TRANSACTIONS, &CryptoNoteProtocolHandler::handle_notify_new_transactions)
HANDLE_NOTIFY(NOTIFY_REQUEST_GET_OBJECTS, &CryptoNoteProtocolHandler::handle_request_get_objects)
HANDLE_NOTIFY(NOTIFY_RESPONSE_GET_OBJECTS, &CryptoNoteProtocolHandler::handle_response_get_objects)
HANDLE_NOTIFY(NOTIFY_REQUEST_CHECKPOINT_LIST, &CryptoNoteProtocolHandler::handle_request_checkpoint_list)
HANDLE_NOTIFY(NOTIFY_RESPONSE_CHECKPOINT_LIST, &CryptoNoteProtocolHandler::handle_response_checkpoint_list)
HANDLE_NOTIFY(NOTIFY_REQUEST_CHAIN, &CryptoNoteProtocolHandler::handle_request_chain)
HANDLE_NOTIFY(NOTIFY_RESPONSE_CHAIN_ENTRY, &CryptoNoteProtocolHandler::handle_response_chain_entry)
HANDLE_NOTIFY(NOTIFY_REQUEST_TX_POOL, &CryptoNoteProtocolHandler::handle_request_tx_pool)
Expand Down Expand Up @@ -1121,4 +1128,12 @@ int CryptoNoteProtocolHandler::doPushLiteBlock(NOTIFY_NEW_LITE_BLOCK::request ar
return 1;
}

int handle_request_checkpoint_list(int command, NOTIFY_REQUEST_CHECKPOINT_LIST::request& arg, CryptoNoteConnectionContext& context)
{
}

int handle_response_checkpoint_list(int command, NOTIFY_RESPONSE_CHECKPOINT_LIST::request& arg, CryptoNoteConnectionContext& context)
{
}

}; // namespace cn
2 changes: 2 additions & 0 deletions src/CryptoNoteProtocol/CryptoNoteProtocolHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ namespace cn
int handle_notify_new_transactions(int command, NOTIFY_NEW_TRANSACTIONS::request& arg, CryptoNoteConnectionContext& context);
int handle_request_get_objects(int command, NOTIFY_REQUEST_GET_OBJECTS::request& arg, CryptoNoteConnectionContext& context);
int handle_response_get_objects(int command, NOTIFY_RESPONSE_GET_OBJECTS::request& arg, CryptoNoteConnectionContext& context);
int handle_request_checkpoint_list(int command, NOTIFY_REQUEST_CHECKPOINT_LIST::request& arg, CryptoNoteConnectionContext& context);
int handle_response_checkpoint_list(int command, NOTIFY_RESPONSE_CHECKPOINT_LIST::request& arg, CryptoNoteConnectionContext& context);
int handle_request_chain(int command, NOTIFY_REQUEST_CHAIN::request& arg, CryptoNoteConnectionContext& context);
int handle_response_chain_entry(int command, NOTIFY_RESPONSE_CHAIN_ENTRY::request& arg, CryptoNoteConnectionContext& context);
int handle_request_tx_pool(int command, NOTIFY_REQUEST_TX_POOL::request &arg, CryptoNoteConnectionContext &context);
Expand Down

0 comments on commit 184fcb2

Please sign in to comment.