Skip to content

Commit

Permalink
#813 eth_sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kladkogex committed Nov 30, 2023
1 parent 88e3085 commit 40a74a0
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions catchup/client/CatchupClientAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,49 @@
#pragma once

class CommittedBlockList;

class ClientSocket;

class Schain;

class CatchupClientThreadPool;

class CatchupRequestHeader;

class CatchupResponseHeader;

class PeerStateInfo;


class CatchupClientAgent : public Agent {

ptr< CatchupClientThreadPool > catchupClientThreadPool = nullptr;
ptr<CatchupClientThreadPool> catchupClientThreadPool = nullptr;

vector<ptr<PeerStateInfo>> peerStateInfos;
recursive_mutex peerStateInfosMutex;

public:
explicit CatchupClientAgent( Schain& _sChain );

explicit CatchupClientAgent(Schain &_sChain);

[[nodiscard]] uint64_t sync( schain_index _dstIndex );
[[nodiscard]] uint64_t sync(schain_index _dstIndex);

static void workerThreadItemSendLoop(CatchupClientAgent *_agent);

static void workerThreadItemSendLoop( CatchupClientAgent* _agent );
[[nodiscard]] nlohmann::json readCatchupResponseHeader(
const ptr<ClientSocket> &_socket, ptr<CatchupRequestHeader> _requestHeader);

nlohmann::json readCatchupResponseHeader(
const ptr< ClientSocket >& _socket, ptr< CatchupRequestHeader > _requestHeader );

[[nodiscard]] ptr<CommittedBlockList> readMissingBlocks(ptr<ClientSocket> &_socket,
nlohmann::json &_responseHeader,
ptr<CatchupRequestHeader> _requestHeader);

ptr< CommittedBlockList > readMissingBlocks( ptr< ClientSocket >& _socket,
nlohmann::json& _responseHeader, ptr< CatchupRequestHeader > _requestHeader );

[[nodiscard]] size_t parseBlockSizes(nlohmann::json _responseHeader,
const ptr<vector<uint64_t> > &_blockSizes,
ptr<CatchupRequestHeader> _requestHeader);

size_t parseBlockSizes( nlohmann::json _responseHeader,
const ptr< vector< uint64_t > >& _blockSizes, ptr< CatchupRequestHeader > _requestHeader );
[[nodiscard]] block_id getMaxKnownBlockId();

static schain_index nextSyncNodeIndex(
const CatchupClientAgent* _agent, schain_index _destinationSchainIndex );
[[nodiscard]] static schain_index nextSyncNodeIndex(
const CatchupClientAgent *_agent, schain_index _destinationSchainIndex);
};

0 comments on commit 40a74a0

Please sign in to comment.