2018-08-08 06:36:51 +00:00
|
|
|
//! # Partially Signed Transactions
|
|
|
|
//!
|
|
|
|
//! Implementation of BIP174 Partially Signed Bitcoin Transaction Format as
|
|
|
|
//! defined at https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki
|
|
|
|
//! except we define PSBTs containing non-standard SigHash types as invalid.
|
|
|
|
|
|
|
|
mod error;
|
|
|
|
pub use self::error::Error;
|
2018-08-10 15:28:48 +00:00
|
|
|
|
|
|
|
pub mod raw;
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use consensus::encode::{deserialize, serialize};
|
|
|
|
use util::psbt::raw;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn serialize_then_deserialize_psbtkvpair() {
|
|
|
|
let expected = raw::Pair {
|
|
|
|
key: raw::Key {
|
|
|
|
type_value: 0u8,
|
|
|
|
key: vec![42u8, 69u8],
|
|
|
|
},
|
|
|
|
value: vec![69u8, 42u8, 4u8],
|
|
|
|
};
|
|
|
|
|
|
|
|
let actual: raw::Pair = deserialize(&serialize(&expected)).unwrap();
|
|
|
|
|
|
|
|
assert_eq!(expected, actual);
|
|
|
|
}
|
|
|
|
}
|