-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_validation.js
More file actions
35 lines (33 loc) · 1.04 KB
/
test_validation.js
File metadata and controls
35 lines (33 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Test validation fix
const { isChainValid } = require('./server/app/Blockchain/Validation');
// Test with mock blockchain data (plain objects like from network)
const testChain = [
{
previousHash: "0",
hash: "genesis_hash",
transactions: [],
nonce: 0,
timestamp: Date.now()
},
{
previousHash: "genesis_hash",
hash: "003f57952f952e82a03a71cdbafca755dda3bf7d63b18044924d2d612e2d58e0",
nonce: 246,
timestamp: Date.now(),
transactions: [
{
fromAddress: null,
toAddress: "04e2345433a9fed1c644c0099f9cc03ee6ad438e847251fda6c8e236e3c49f577d1697baa40e4f3473c9da8e359a95ef0ba98848028558caf558a4d3ba8a16d3a8",
amount: 100,
signature: ""
}
]
}
];
console.log('Testing validation fix...');
try {
const result = isChainValid(testChain);
console.log('✅ Validation fix works! Result:', result);
} catch (error) {
console.log('❌ Validation fix failed:', error.message);
}