Repository: hashgraph/hedera-services
Issue: Ensure SystemFileManager.loadAllSystemFiles is called in ServicesMain.init before any properties are accessed

**Summary of the defect**
Currently `ServicesMain.init` starts the record stream thread _before_ calling `SystemFilesManager.loadAllSystemFiles` if necessary (as on a restart). Hence when this call _is_ necessary, the record stream directory will always be the default.

Changed files:
hedera-node/src/main/java/com/hedera/services/ServicesMain.java, hedera-node/src/test/java/com/hedera/services/ServicesMainTest.java, hedera-node/src/main/java/com/hedera/services/legacy/stream/RecordStream.java

diff --git a/hedera-node/src/main/java/com/hedera/services/ServicesMain.java b/hedera-node/src/main/java/com/hedera/services/ServicesMain.java
index 61a767710f..8264b007bd 100644
--- a/hedera-node/src/main/java/com/hedera/services/ServicesMain.java
+++ b/hedera-node/src/main/java/com/hedera/services/ServicesMain.java
@@ -142,28 +142,28 @@ public class ServicesMain implements SwirldMain {
 	}
 
 	private void contextDrivenInit() {
-		registerIssListener();
-		log.info("Platform callbacks registered.");
 		checkPropertySources();
 		log.info("Property sources are available.");
-		configurePlatform();
-		log.info("Platform is configured.");
+		initSystemFiles();
+		log.info("System files rationalized.");
+		createSystemAccountsIfNeeded();
+		log.info("System accounts initialized.");
 		migrateStateIfNeeded();
 		log.info("Migrations complete.");
-		startRecordStreamThread();
-		log.info("Record stream started.");
-		startNettyIfAppropriate();
-		log.info("Netty started.");
-		createSystemAccountsIfNeeded();
-		log.info("System accounts rationalized.");
 		validateLedgerState();
 		log.info("Ledger state ok.");
-		createSystemFilesIfNeeded();
-		log.info("System files rationalized.");
+		configurePlatform();
+		log.info("Platform is configured.");
+		registerIssListener();
+		log.info("Platform callbacks registered.");
 		exportAccountsIfDesired();
 		log.info("Accounts exported.");
 		initializeStats();
 		log.info("Stats initialized.");
+		startRecordStreamThread();
+		log.info("Record stream started in directory {}.", ctx.recordStream().getRecordStreamsDirectory());
+		startNettyIfAppropriate();
+		log.info("Netty started.");
 
 		log.info("Completed initialization of {} #{}", ctx.nodeType(), ctx.id());
 	}
@@ -181,7 +181,7 @@ public class ServicesMain implements SwirldMain {
 		}
 	}
 
-	private void createSystemFilesIfNeeded() {
+	private void initSystemFiles() {
 		try {
 			ctx.systemFilesManager().createAddressBookIfMissing();
 			ctx.systemFilesManager().createNodeDetailsIfMissing();
@@ -238,10 +238,6 @@ public class ServicesMain implements SwirldMain {
 		return myNodeAccount.equals(blessedNodeAccount);
 	}
 
-	private void loadFeeSchedule() {
-		ctx.fees().init();
-	}
-
 	private void initializeStats() {
 		ctx.statsManager().initializeFor(ctx.platform());
 	}
diff --git a/hedera-node/src/main/java/com/hedera/services/legacy/stream/RecordStream.java b/hedera-node/src/main/java/com/hedera/services/legacy/stream/RecordStream.java
index 507d04bea9..b578231b0f 100644
--- a/hedera-node/src/main/java/com/hedera/services/legacy/stream/RecordStream.java
+++ b/hedera-node/src/main/java/com/hedera/services/legacy/stream/RecordStream.java
@@ -85,7 +85,7 @@ public class RecordStream implements Runnable {
 	Platform platform;
 	MiscRunningAvgs runningAvgs;
 	boolean inFreeze;
-	String recordStreamsDirectory;
+	final String recordStreamsDirectory;
 
 	private final PropertySource properties;
 
@@ -395,6 +395,10 @@ public class RecordStream implements Runnable {
 		return recordBuffer.size();
 	}
 
+	public String getRecordStreamsDirectory() {
+		return recordStreamsDirectory;
+	}
+
 	/**
 	 * Read the FileHash from the record stream signature file
 	 *
diff --git a/hedera-node/src/test/java/com/hedera/services/ServicesMainTest.java b/hedera-node/src/test/java/com/hedera/services/ServicesMainTest.java
index f4d7638cec..1467f14fae 100644
--- a/hedera-node/src/test/java/com/hedera/services/ServicesMainTest.java
+++ b/hedera-node/src/test/java/com/hedera/services/ServicesMainTest.java
@@ -243,6 +243,7 @@ public class ServicesMainTest {
 	public void initializesSanelyGivenPreconditions() {
 		// given:
 		InOrder inOrder = inOrder(
+				systemFilesManager,
 				propertySources,
 				platform,
 				stateMigrations,
@@ -257,14 +258,15 @@ public class ServicesMainTest {
 		subject.init(null, new NodeId(false, NODE_ID));
 
 		// then:
-		inOrder.verify(platform).addSignedStateListener(any(IssListener.class));
 		inOrder.verify(propertySources).assertSourcesArePresent();
-		inOrder.verify(platform).setSleepAfterSync(0L);
+		inOrder.verify(systemFilesManager).loadAllSystemFiles();
 		inOrder.verify(stateMigrations).runAllFor(ctx);
-		inOrder.verify(recordStreamThread).start();
 		inOrder.verify(ledgerValidator).assertIdsAreValid(accounts);
 		inOrder.verify(ledgerValidator).hasExpectedTotalBalance(accounts);
+		inOrder.verify(platform).setSleepAfterSync(0L);
+		inOrder.verify(platform).addSignedStateListener(any(IssListener.class));
 		inOrder.verify(statsManager).initializeFor(platform);
+		inOrder.verify(recordStreamThread).start();
 	}
 
 	@Test