Skip to content

Commit 3fa38ca

Browse files
committed
Blockchain problem setup
1 parent 41fc613 commit 3fa38ca

File tree

1 file changed

+1
-35
lines changed

1 file changed

+1
-35
lines changed

src/blockchain.js

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -82,41 +82,7 @@ class Blockchain {
8282
}
8383

8484
validateBlock(block) {
85-
if (this.blocks[block.hashString()]) {
86-
return false;
87-
}
88-
89-
if (block.isGenesis) {
90-
return true;
91-
}
92-
93-
if (!block.isGenesis && block.previous === NULL_PUBLIC_KEY) {
94-
return false;
95-
}
96-
97-
if (block.previous !== NULL_PUBLIC_KEY) {
98-
if (!this.blocks[block.previous]) {
99-
return false;
100-
}
101-
102-
if (this.blocks[block.previous].height < this.getTipBlock().height - 6) {
103-
return false;
104-
}
105-
}
106-
107-
if (block.nonce < 0x0) {
108-
return false;
109-
}
110-
111-
for (const transaction of block.transactions) {
112-
if (!block.isGenesis && transaction.source === NULL_PUBLIC_KEY) {
113-
return false;
114-
}
115-
116-
if (!this.validateTransaction(transaction)) {
117-
return false;
118-
}
119-
}
85+
// TODO
12086

12187
return true;
12288
}

0 commit comments

Comments
 (0)