Skip to content

Commit e3d2bfb

Browse files
author
Oleksandr Fedorenko
committed
fixup! fix error handling for GET /block/:hash/txs/:index
1 parent 606b9bc commit e3d2bfb

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/rest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ fn handle_request(
781781
(&Method::GET, Some(&"block"), Some(hash), Some(&"txs"), start_index, None) => {
782782
let hash = BlockHash::from_str(hash)?;
783783

784-
// Add ligthweight validation that block exists before fetching transactions,
784+
// Add lightweight validation that block exists before fetching transactions,
785785
// to avoid expensive lookups in case of invalid block hash
786786
query.chain().get_block_header(&hash)
787787
.ok_or_else(|| HttpError::not_found("Block not found".to_string()))?;
@@ -792,7 +792,7 @@ fn handle_request(
792792

793793
ensure!(
794794
start_index % CHAIN_TXS_PER_PAGE == 0,
795-
"start index must be a multiplication of {}",
795+
"start index must be a multiple of {}",
796796
CHAIN_TXS_PER_PAGE
797797
);
798798

tests/rest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ fn test_rest_block_txs() -> Result<()> {
392392
.build()
393393
.call()?;
394394
assert_eq!(invalid_hash_resp.status(), 400);
395-
assert_eq!(invalid_hash_resp.into_body().read_to_string()?, "start index must be a multiplication of 25");
395+
assert_eq!(invalid_hash_resp.into_body().read_to_string()?, "start index must be a multiple of 25");
396396

397397
// Test GET /block/:hash/txs/:index
398398
// Should fail with 400 code when index is out of range

0 commit comments

Comments
 (0)