Skip to content

Instantly share code, notes, and snippets.

@GeertJohan
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeertJohan/46c30b7d8124476ef100 to your computer and use it in GitHub Desktop.
Save GeertJohan/46c30b7d8124476ef100 to your computer and use it in GitHub Desktop.
type block struct {
height int64
time time.Time
diff *big.Int
}
type chain struct {
ladder []*block
}
// DiffAlgo is the interface through which difficulty algorithms for the diffsim are implemented
type DiffAlgo interface {
// Name must return the name for the interface
Name() string
// Calculate gives the diff algo the chain on which to calculate the new difficulty
// The returned difficulty (*bit.Int) indicates the amount of work that must be done before a valid block hash is hit.
Calculate(c *chain) *big.Int
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment