-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from Foundation-Devices/jeandudey/sft-2562-add…
…-psbt-test-vectors SFT-2562: Add BIP-174 test vectors.
- Loading branch information
Showing
6 changed files
with
338 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SPDX-FileCopyrightText: © 2017 Andrew Chow <achow101@gmail.com> | ||
SPDX-FileCopyrightText: © 2023 Foundation Devices, Inc. <hello@foundationdevices.com> | ||
SPDX-License-Identifier: BSD-2-Clause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-FileCopyrightText: © 2023 Foundation Devices, Inc. <hello@foundationdevices.com> | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#[derive(Debug, serde::Deserialize)] | ||
pub struct TestVectors { | ||
pub invalid: Vec<TestVector>, | ||
pub valid: Vec<TestVector>, | ||
} | ||
|
||
impl TestVectors { | ||
pub fn new() -> Self { | ||
serde_json::from_slice(include_bytes!("../data/bip-0174.json")) | ||
.expect("file should be valid JSON") | ||
} | ||
} | ||
|
||
#[derive(Debug, serde::Deserialize)] | ||
pub struct TestVector { | ||
pub description: String, | ||
#[serde(with = "hex", rename = "as-hex")] | ||
pub data: Vec<u8>, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_new() { | ||
TestVectors::new(); | ||
} | ||
} |