Skip to content

Commit 30bf547

Browse files
dr-orlovskytcharding
authored andcommitted
Witness serde: test binary encoding to be backward-compatible
This also removes tests for JSON backward-compatible encoding. Human-readable encoding will be changed in the next commit and this will break backward compatibility, thus that part of the test is removed.
1 parent eda0d25 commit 30bf547

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/blockdata/witness.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,20 +423,21 @@ mod test {
423423

424424
#[cfg(feature = "serde")]
425425
#[test]
426-
fn test_serde() {
427-
use serde_json;
426+
fn test_serde_bincode() {
427+
use bincode;
428428

429429
let old_witness_format = vec![vec![0u8], vec![2]];
430430
let new_witness_format = Witness::from_vec(old_witness_format.clone());
431431

432-
let old = serde_json::to_string(&old_witness_format).unwrap();
433-
let new = serde_json::to_string(&new_witness_format).unwrap();
432+
let old = bincode::serialize(&old_witness_format).unwrap();
433+
let new = bincode::serialize(&new_witness_format).unwrap();
434434

435435
assert_eq!(old, new);
436436

437-
let back = serde_json::from_str(&new).unwrap();
437+
let back: Witness = bincode::deserialize(&new).unwrap();
438438
assert_eq!(new_witness_format, back);
439439
}
440+
440441
}
441442

442443

0 commit comments

Comments
 (0)