Skip to content
Draft
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions src/main/AppConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ AppConnector::now() const
return mApp.getClock().now();
}

VirtualClock::system_time_point
AppConnector::systemNow() const
{
return mApp.getClock().system_now();
}

bool
AppConnector::shouldYield() const
{
Expand Down
1 change: 1 addition & 0 deletions src/main/AppConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class AppConnector
void postOnEvictionBackgroundThread(std::function<void()>&& f,
std::string const& jobName);
VirtualClock::time_point now() const;
VirtualClock::system_time_point systemNow() const;
Config const& getConfig() const;
rust::Box<rust_bridge::SorobanModuleCache> getModuleCache();
bool overlayShuttingDown() const;
Expand Down
9 changes: 7 additions & 2 deletions src/main/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static std::unordered_set<std::string> const TESTING_ONLY_OPTIONS = {

// Options that should only be used for testing
static std::unordered_set<std::string> const TESTING_SUGGESTED_OPTIONS = {
"ALLOW_LOCALHOST_FOR_TESTING"};
"ALLOW_LOCALHOST_FOR_TESTING", "ALLOW_PRIVATE_ADDRESSES_FOR_TESTING"};

namespace
{
Expand Down Expand Up @@ -162,7 +162,7 @@ Config::Config() : NODE_SEED(SecretKey::random())
LEDGER_PROTOCOL_MIN_VERSION_INTERNAL_ERROR_REPORT = 18;

OVERLAY_PROTOCOL_MIN_VERSION = 40;
OVERLAY_PROTOCOL_VERSION = 41;
OVERLAY_PROTOCOL_VERSION = 42;

VERSION_STR = STELLAR_CORE_VERSION;

Expand Down Expand Up @@ -199,6 +199,7 @@ Config::Config() : NODE_SEED(SecretKey::random())
std::chrono::seconds::zero();
ARTIFICIALLY_DELAY_LEDGER_CLOSE_FOR_TESTING = std::chrono::milliseconds(0);
ALLOW_LOCALHOST_FOR_TESTING = false;
ALLOW_PRIVATE_ADDRESSES_FOR_TESTING = false;
USE_CONFIG_FOR_GENESIS = false;
GENESIS_TEST_ACCOUNT_COUNT = 0;
FAILURE_SAFETY = -1;
Expand Down Expand Up @@ -1315,6 +1316,10 @@ Config::processConfig(std::shared_ptr<cpptoml::table> t)
}},
{"ALLOW_LOCALHOST_FOR_TESTING",
[&]() { ALLOW_LOCALHOST_FOR_TESTING = readBool(item); }},
{"ALLOW_PRIVATE_ADDRESSES_FOR_TESTING",
[&]() {
ALLOW_PRIVATE_ADDRESSES_FOR_TESTING = readBool(item);
}},
{"PUBLISH_TO_ARCHIVE_DELAY",
[&]() {
PUBLISH_TO_ARCHIVE_DELAY =
Expand Down
7 changes: 7 additions & 0 deletions src/main/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,13 @@ class Config : public std::enable_shared_from_this<Config>
// this should only be enabled when testing as it's a security issue
bool ALLOW_LOCALHOST_FOR_TESTING;

// A config to allow gossiping (advertising and accepting in PEERS
// messages) and connecting to RFC1918 private addresses (10/8, 172.16/12,
// 192.168/16). Private addresses are normally filtered out of peer
// exchange, which disables gossip-based peer discovery in environments
// where every node has a private address (e.g. a Kubernetes pod network).
bool ALLOW_PRIVATE_ADDRESSES_FOR_TESTING;

// Set to use config file values for genesis ledger
// not setable in config file - only tests are allowed to do this
bool USE_CONFIG_FOR_GENESIS;
Expand Down
6 changes: 2 additions & 4 deletions src/main/PersistentState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ std::string PersistentState::mainMapping[kLastEntryMain] = {
"networkpassphrase", "rebuildledger"};

std::string PersistentState::miscMapping[kLastEntry] = {
"miscdatabaseschema",
"ledgerupgrades",
"lastscpdataxdr",
"txset",
"miscdatabaseschema", "ledgerupgrades", "lastscpdataxdr", "txset",
"quorumpeerinfo",
};

std::string PersistentState::kSQLCreateStatement =
Expand Down
1 change: 1 addition & 0 deletions src/main/PersistentState.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class PersistentState
kLedgerUpgrades,
kLastSCPDataXDR,
kTxSet,
kQuorumPeerInfo,
kLastEntry,
};

Expand Down
5 changes: 5 additions & 0 deletions src/overlay/OverlayManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace stellar
class PeerAuth;
class PeerBareAddress;
class PeerManager;
class QuorumPeerState;
class SurveyManager;
struct StellarMessage;

Expand Down Expand Up @@ -141,6 +142,8 @@ class OverlayManager
virtual bool acceptAuthenticatedPeer(Peer::pointer peer) = 0;

virtual bool isPreferred(Peer* peer) const = 0;
virtual bool isDirectQsetPeer(NodeID const& nodeID) const = 0;
virtual void recordProbedNonQsetAddress(PeerBareAddress const& address) = 0;
virtual bool isPossiblyPreferred(std::string const& ip) const = 0;
virtual bool haveSpaceForConnection(std::string const& ip) const = 0;

Expand Down Expand Up @@ -189,6 +192,8 @@ class OverlayManager

// Return the persistent peer manager
virtual PeerManager& getPeerManager() = 0;
virtual QuorumPeerState& getQuorumPeerState() = 0;
virtual void persistQuorumPeerState() = 0;

virtual SurveyManager& getSurveyManager() = 0;

Expand Down
Loading
Loading