Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow lower case for abci::data #17

Merged
merged 3 commits into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions tendermint/src/abci/data.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{Error, ErrorKind};
use serde::{de::Error as _, Deserialize, Deserializer, Serialize, Serializer};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::{
fmt::{self, Display},
str::FromStr,
Expand Down Expand Up @@ -50,10 +50,10 @@ impl FromStr for Data {

impl<'de> Deserialize<'de> for Data {
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
let bytes = hex::decode(String::deserialize(deserializer)?.as_bytes())
.map_err(|e| D::Error::custom(format!("{}", e)))?;

Ok(Self(bytes))
use serde::de::Error;
String::deserialize(deserializer)?
.parse()
.map_err(D::Error::custom)
}
}

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 @@ -3,7 +3,7 @@
"id": "",
"result": {
"code": "0",
"data": "",
"data": "AABBCC",
"log": "",
"hash": "88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589"
}
Expand Down
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 @@ -3,7 +3,7 @@
"id": "",
"result": {
"code": 0,
"data": "",
"data": "aabbcc",
"log": "",
"hash": "88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589"
}
Expand Down