Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ExternalBlock Type and Cache #6

Closed
alanorwick opened this issue Aug 4, 2021 · 0 comments · Fixed by #75
Closed

Implement ExternalBlock Type and Cache #6

alanorwick opened this issue Aug 4, 2021 · 0 comments · Fixed by #75
Assignees
Labels
enhancement New feature or request

Comments

@alanorwick
Copy link
Contributor

ExternalBlocks are blocks that are sent from the manager with external transactions terminating in the receiving nodes context. We break down a standard block into an ExternalBlock in order to save space on disk for validating and time downloading from manager.

An ExternalBlock struct will look roughly like this:

// ExternalBlock represents an external block with transactions destined for a specific context.
type ExternalBlock struct {
	header       *Header
	externalTxs  Transactions
	originLocation byte
	
	// caches
	hash atomic.Value
	size atomic.Value

	// Td is used by package core to store the total difficulty
	// of the chain up to and including the block.
	td *big.Int

	// These fields are used by package eth to track
	// inter-peer block relay.
	ReceivedAt   time.Time
	ReceivedFrom interface{}
}

Implementation requirements:

  • External Block cache of type *lru.Cache for fast look up during validation.
  • Method of listening for blocks from manager to update the cache.
@alanorwick alanorwick self-assigned this Aug 11, 2021
@alanorwick alanorwick added the enhancement New feature or request label Aug 11, 2021
@alanorwick alanorwick linked a pull request Sep 8, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant