From 8a600b3a9480b1517535650a5735d2bd84887b1d Mon Sep 17 00:00:00 2001 From: Hidenori Shinohara Date: Wed, 24 Aug 2022 12:16:16 -0400 Subject: [PATCH] Add new XDR structs & fields for pull mode --- Stellar-overlay.x | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/Stellar-overlay.x b/Stellar-overlay.x index 0601a3a..64fd97a 100644 --- a/Stellar-overlay.x +++ b/Stellar-overlay.x @@ -47,11 +47,20 @@ 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 @@ -102,7 +111,9 @@ enum MessageType SURVEY_REQUEST = 14, SURVEY_RESPONSE = 15, - SEND_MORE = 16 + SEND_MORE = 16, + FLOOD_ADVERT = 18, + FLOOD_DEMAND = 19 }; struct DontHave @@ -185,6 +196,22 @@ case SURVEY_TOPOLOGY: TopologyResponseBody topologyResponseBody; }; +const TX_ADVERT_VECTOR_MAX_SIZE = 1000; +typedef Hash TxAdvertVector; + +struct FloodAdvert +{ + TxAdvertVector txHashes; +}; + +const TX_DEMAND_VECTOR_MAX_SIZE = 1000; +typedef Hash TxDemandVector; + +struct FloodDemand +{ + TxDemandVector txHashes; +}; + union StellarMessage switch (MessageType type) { case ERROR_MSG: @@ -227,6 +254,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)