if (!/^[0-9A-Fa-f]{64}$/.test(hash ?? '')) {
throw new Error('Invalid hash. Must be a 64-character hex string.')
}
- if (difficulty && !/^[1-9A-Fa-f][0-9A-Fa-f]{0,15}$/.test(difficulty)) {
+ if (difficulty && !/^[1-9A-Fa-f]{1}[0-9A-Fa-f]{0,15}$/.test(difficulty)) {
throw new Error('Invalid difficulty. Must be a hexadecimal string between 1-FFFFFFFFFFFFFFFF.')
}
if (action === 'work_validate' && !/^[0-9A-Fa-f]{16}$/.test(work ?? '')) {