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

Dynamically load default Block and Transaction classes #19

Open
taustin opened this issue Sep 10, 2020 · 1 comment
Open

Dynamically load default Block and Transaction classes #19

taustin opened this issue Sep 10, 2020 · 1 comment

Comments

@taustin
Copy link
Owner

taustin commented Sep 10, 2020

This might have to wait on converting to ES6 modules.

@taustin
Copy link
Owner Author

taustin commented Sep 10, 2020

More details:

The Block and Transaction classes have been made configurable in order to make SpartanGold more extensible.

However, that means the these classes must be specified, even if the default implementations are perfectly fine.

Here is how driver.js currently creates the genesis block:

// Creating genesis block
let genesis = Blockchain.makeGenesis({
  blockClass: Block,
  transactionClass: Transaction,
  clientBalanceMap: new Map([
    [alice, 233],
    [bob, 99],
    [charlie, 67],
    [minnie, 400],
    [mickey, 300],
  ]),
});

Instead, it should look like:

// Creating genesis block
let genesis = Blockchain.makeGenesis({
  clientBalanceMap: new Map([
    [alice, 233],
    [bob, 99],
    [charlie, 67],
    [minnie, 400],
    [mickey, 300],
  ]),
});

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

No branches or pull requests

1 participant