Behaviour of getblock

+1 vote

Hi, I was doing a bit of testing with getblock and noticed some unexpected behaviour

When I give the request a blockId way beyond the current block height of the chain I'll get an error - Block height out of range - All good

But when I give the request some random strings, for example ''a", "ab", "fab"  all return the first block 0 in the chain.

Passing "1234fab" returns block 1234 - I can see what's it's doing there,

and passing a transaction Hash returns "Block not found".

 

I was testing this to understand what error handling to do on our end, and feel the behaviour for passing an incorrect block-id is a bit inconsistent.  It would be much cleaner to just return a block not found response in all these error conditions.

 

What are your thoughts?

 

Cheers

 

Marty

 

 

 

 

 

 

 

asked Mar 30, 2018 by marty

2 Answers

0 votes
 
Best answer
Thanks, this is just an API parameter parsing issue. These random strings aren't legitimate ways of identifying a block and it should return an error.
answered Mar 31, 2018 by MultiChain
selected Mar 31, 2018 by marty
0 votes
Version 1.0.5 of MultiChain has just been released, and it should fix this.
answered Jun 7, 2018 by MultiChain
...