Skip to content

Commit

Permalink
RPC: Update hash to 32 byte value. (#14)
Browse files Browse the repository at this point in the history
Update tests to new standard
  • Loading branch information
amanusk authored and ebuchman committed Sep 7, 2019
1 parent aae12cb commit 5b83c04
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/abci/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ impl<'de> Deserialize<'de> for Code {
where
E: serde::de::Error,
{
match val.parse::<u32>() {
Ok(val) => self.visit_u32(val),
match val.parse::<u64>() {
Ok(val) => self.visit_u64(val),
Err(_) => Err(E::custom("failed to parse integer")),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/abci/transaction/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use subtle::{self, ConstantTimeEq};
use subtle_encoding::hex;

/// Size of a transaction hash in bytes
pub const LENGTH: usize = 20;
pub const LENGTH: usize = 32;

/// Trannsaction hashes
#[derive(Copy, Clone, Hash)]
Expand Down
8 changes: 4 additions & 4 deletions tests/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ mod endpoints {

assert_eq!(
&response.hash.to_string(),
"E39AAB7A537ABAA237831742DCE1117F187C3C52"
"88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589"
);
}

Expand All @@ -126,7 +126,7 @@ mod endpoints {

assert_eq!(
&response.hash.to_string(),
"0D33F2F03A5234F38706E43004489E061AC40A2E"
"88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589"
);
}

Expand All @@ -141,7 +141,7 @@ mod endpoints {

assert_eq!(
&response.hash.to_string(),
"0D33F2F03A5234F38706E43004489E061AC40A2E"
"88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589"
);
}

Expand All @@ -154,7 +154,7 @@ mod endpoints {

assert_eq!(
&response.hash.to_string(),
"75CA0F856A4DA078FC4911580360E70CEFB2EBEE"
"88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589"
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/support/rpc/broadcast_tx_async.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"jsonrpc": "2.0",
"id": "",
"result": {
"hash": "E39AAB7A537ABAA237831742DCE1117F187C3C52",
"hash": "88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589",
"log": "",
"data": "",
"code": "0"
Expand Down
2 changes: 1 addition & 1 deletion tests/support/rpc/broadcast_tx_commit.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "",
"result": {
"height": "26682",
"hash": "75CA0F856A4DA078FC4911580360E70CEFB2EBEE",
"hash": "88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589",
"deliver_tx": {
"log": "",
"data": "",
Expand Down
2 changes: 1 addition & 1 deletion tests/support/rpc/broadcast_tx_sync.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"code": "0",
"data": "",
"log": "",
"hash": "0D33F2F03A5234F38706E43004489E061AC40A2E"
"hash": "88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589"
}
}
2 changes: 1 addition & 1 deletion tests/support/rpc/broadcast_tx_sync_int.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"code": 0,
"data": "",
"log": "",
"hash": "0D33F2F03A5234F38706E43004489E061AC40A2E"
"hash": "88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589"
}
}

0 comments on commit 5b83c04

Please sign in to comment.