node-http: add check for height being below tip
This commit simply adds an enforce line to check that the height being requested to reset to is below the chain tip. This way we return a bad request error rather than a internal server error.
This commit is contained in:
parent
d601b6a303
commit
d5514d9dcb
@ -339,6 +339,8 @@ class HTTP extends Server {
|
||||
const height = valid.u32('height');
|
||||
|
||||
enforce(height != null, 'Height is required.');
|
||||
enforce(height <= this.chain.height,
|
||||
'Height cannot be greater than chain tip.');
|
||||
|
||||
await this.chain.reset(height);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user