Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add adverts & demands to StellarMessage for pull mode #24

Merged
merged 1 commit into from
Sep 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions Stellar-overlay.x
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,19 @@ struct Hello
uint256 nonce;
};

// During the roll-out phrase, pull mode will be optional.
// Therefore, we need a way to communicate with other nodes
// that we want/don't want pull mode.
// However, the goal is for everyone to enable it by default,
// so we don't want to introduce a new member variable.
// For now, we'll use the `flags` field (originally named
// `unused`) in `Auth`.
// 100 is just a number that is not 0.
const AUTH_MSG_FLAG_PULL_MODE_REQUESTED = 100;

struct Auth
{
// Empty message, just to confirm
// establishment of MAC keys.
int unused;
int flags;
};

enum IPAddrType
Expand Down Expand Up @@ -102,7 +110,9 @@ enum MessageType
SURVEY_REQUEST = 14,
SURVEY_RESPONSE = 15,

SEND_MORE = 16
SEND_MORE = 16,
FLOOD_ADVERT = 18,
FLOOD_DEMAND = 19
};

struct DontHave
Expand Down Expand Up @@ -179,6 +189,22 @@ struct TopologyResponseBody
uint32 totalOutboundPeerCount;
};

const TX_ADVERT_VECTOR_MAX_SIZE = 1000;
typedef Hash TxAdvertVector<TX_ADVERT_VECTOR_MAX_SIZE>;

struct FloodAdvert
{
TxAdvertVector txHashes;
};

const TX_DEMAND_VECTOR_MAX_SIZE = 1000;
typedef Hash TxDemandVector<TX_DEMAND_VECTOR_MAX_SIZE>;

struct FloodDemand
{
TxDemandVector txHashes;
};

union SurveyResponseBody switch (SurveyMessageCommandType type)
{
case SURVEY_TOPOLOGY:
Expand Down Expand Up @@ -227,6 +253,12 @@ case GET_SCP_STATE:
uint32 getSCPLedgerSeq; // ledger seq requested ; if 0, requests the latest
case SEND_MORE:
SendMore sendMoreMessage;

// Pull mode
case FLOOD_ADVERT:
FloodAdvert floodAdvert;
case FLOOD_DEMAND:
FloodDemand floodDemand;
};

union AuthenticatedMessage switch (uint32 v)
Expand Down