Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Extract creation and init of ProtocolContext into a re-usable class #828

Merged
merged 7 commits into from
Feb 12, 2019

Conversation

ajsutton
Copy link
Contributor

PR description

Extracts creation of BlockchainStorage, MutableBlockchain, WorldStateStorage, WorldStateArchive and ProtocolContext into a reusable factory. Apart from removing duplication from the different PantheonController implementations, this will give us a single place to hook in data migrations that we anticipate will be required soon.

this.worldStateStorage = worldStateStorage;
}

public static <T> DataStores<T> initDataStores(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(discussion) Wondering if this should move to ProtocolContext.init - since it seems to just deal with setting up that object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would work quite nicely now that you've pointed out the existence of WorldStateArchive.getStorage. I swear I went looking for that and it wasn't there yesterday.... :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, much nicer now - just moving duplicated code into a ProtocolContext.init.

@ajsutton ajsutton merged commit 211e95e into PegaSysEng:master Feb 12, 2019
@ajsutton ajsutton deleted the extra-storage-init branch February 12, 2019 22:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants