Skip to content

Conversation

seanrobbins
Copy link
Contributor

@seanrobbins seanrobbins commented Jan 13, 2018

What does this PR do?

Uses Guice dependency injection to provide a Singleton instance of the Blockchain class. Blockchain no longer had a dependency on Wallet being created first, so can now be instantiated at the start of the system, and that really seems to make sense.

Injects the Blockchain dependency on the constructor of UTXOSet.

Injects individual dependencies into PeerBuilder instead of the whole injector, as the change to Blockchain makes this possible now.

Why are these changes required?

So much depends on the Blockchain and it feels natural to have this class launched as a single instance when the system launches.

UTXOSet has Blockchain as an absolute dependency (it'll NullPointer if reindex is called without Blockchain set), so it's nicer to inject on the UTXOSet constructor.

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Extra details

I've put these changes in a separate PR, so they can be assessed independently from the added unit test coverage.

I'd suggest merging #58 before merging these changes.

@seanrobbins seanrobbins mentioned this pull request Jan 13, 2018
@sasaxie sasaxie merged commit d5dd19e into tronprotocol:develop Jan 14, 2018
@seanrobbins seanrobbins deleted the refactorBlockchainDependency branch January 16, 2018 10:23
zhaohong pushed a commit that referenced this pull request Feb 5, 2018
 RAwTIEDpVs0S2BSAxEQBwhLlYYctzLGVh7iQtCjpnkQJ8D5huyvaMsBuhsplKn+L
 b5VNN/iP6N4+sA8YcElB//LwANVI8XgnDtPG//uAH1fhYG1sZV6eqBSj4nLIgtmB
 eXTBlzwmkrYkE0SdpkRADjquUs8rcjX00RwOE1CwrX+/7WdEDQZjti5AErBrbJKg
 afKPVEfTSQWyTyzYfvXH/2D9+FvD0m0O4TGRPqQIkdzFjxuJ3FfwzS7K4j1JadGa
 Y7chmEZiQBNhDRXYCGOl08/FhVIN2Axbo3z/21TARZCrqv/d6jxIMEvRf2wCvXo=
 =pB4R
 -----END PGP SIGNATURE-----
 

Merge pull request #59 from seanrobbins/refactorBlockchainDependency

Refactor blockchain dependency
CodeNinjaEvan pushed a commit that referenced this pull request May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants