Use Option<[u8; N]> for JoinSplit pubkey and signature in a transaction
This commit is contained in:
@@ -156,6 +156,46 @@ fn tx_read_write() {
|
||||
assert_eq!(&data[..], &encoded[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tx_write_rejects_unexpected_joinsplit_pubkey() {
|
||||
// Succeeds without a JoinSplit pubkey
|
||||
{
|
||||
let tx = TransactionData::new().freeze();
|
||||
let mut encoded = Vec::new();
|
||||
assert!(tx.write(&mut encoded).is_ok());
|
||||
}
|
||||
|
||||
// Fails with an unexpected JoinSplit pubkey
|
||||
{
|
||||
let mut tx = TransactionData::new();
|
||||
tx.joinsplit_pubkey = Some([0; 32]);
|
||||
let tx = tx.freeze();
|
||||
|
||||
let mut encoded = Vec::new();
|
||||
assert!(tx.write(&mut encoded).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tx_write_rejects_unexpected_joinsplit_sig() {
|
||||
// Succeeds without a JoinSplit signature
|
||||
{
|
||||
let tx = TransactionData::new().freeze();
|
||||
let mut encoded = Vec::new();
|
||||
assert!(tx.write(&mut encoded).is_ok());
|
||||
}
|
||||
|
||||
// Fails with an unexpected JoinSplit signature
|
||||
{
|
||||
let mut tx = TransactionData::new();
|
||||
tx.joinsplit_sig = Some([0; 64]);
|
||||
let tx = tx.freeze();
|
||||
|
||||
let mut encoded = Vec::new();
|
||||
assert!(tx.write(&mut encoded).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tx_write_rejects_unexpected_binding_sig() {
|
||||
// Succeeds without a binding signature
|
||||
|
||||
Reference in New Issue
Block a user