Skip to content

Commit

Permalink
Merge PR #597 from 'enable-checkpoints'
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Sep 1, 2021
2 parents f40e44e + a28f1cf commit 72892cc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
15 changes: 8 additions & 7 deletions lib/blockchain/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,17 +659,18 @@ class Chain extends AsyncEmitter {
const hardened = state.hasHardening();
const view = new CoinView();
const height = prev.height + 1;
const cb = block.txs[0];

assert(view.bits.spend(this.db.field, cb));

view.addTX(cb, height);
assert(block.treeRoot.equals(this.db.treeRoot()));

for (let i = 1; i < block.txs.length; i++) {
for (let i = 0; i < block.txs.length; i++) {
const tx = block.txs[i];

assert(await view.spendInputs(this.db, tx),
'BUG: Spent inputs in historical data!');
if (i === 0) {
assert(view.bits.spend(this.db.field, tx));
} else {
assert(await view.spendInputs(this.db, tx),
'BUG: Spent inputs in historical data!');
}

await this.verifyCovenants(tx, view, height, hardened);

Expand Down
20 changes: 18 additions & 2 deletions lib/protocol/networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,23 @@ main.brontidePort = 44806;

main.checkpointMap = {
1008: Buffer.from(
'0000000000001013c28fa079b545fb805f04c496687799b98e35e83cbbb8953e', 'hex')
'0000000000001013c28fa079b545fb805f04c496687799b98e35e83cbbb8953e', 'hex'),
2016: Buffer.from(
'0000000000000424ee6c2a5d6e0da5edfc47a4a10328c1792056ee48303c3e40', 'hex'),
10000: Buffer.from(
'00000000000001a86811a6f520bf67cefa03207dc84fd315f58153b28694ec51', 'hex'),
20000: Buffer.from(
'0000000000000162c7ac70a582256f59c189b5c90d8e9861b3f374ed714c58de', 'hex'),
30000: Buffer.from(
'0000000000000004f790862846b23c3a81585aea0fa79a7d851b409e027bcaa7', 'hex'),
40000: Buffer.from(
'0000000000000002966206a40b10a575cb46531253b08dae8e1b356cfa277248', 'hex'),
50000: Buffer.from(
'00000000000000020c7447e7139feeb90549bfc77a7f18d4ff28f327c04f8d6e', 'hex'),
56880: Buffer.from(
'0000000000000001d4ef9ea6908bb4eb970d556bd07cbd7d06a634e1cd5bbf4e', 'hex'),
61043: Buffer.from(
'00000000000000015b84385e0307370f8323420eaa27ef6e407f2d3162f1fd05', 'hex')
};

/**
Expand All @@ -93,7 +109,7 @@ main.checkpointMap = {
* @default
*/

main.lastCheckpoint = 1008;
main.lastCheckpoint = 61043;

/**
* Reward halving interval.
Expand Down

0 comments on commit 72892cc

Please sign in to comment.