Skip to content
Permalink
Browse files

Add Witness Data for Multisig

  • Loading branch information...
vincenthz committed May 11, 2019
1 parent 3a948cd commit b7b97a61f1eb40e06de9eefe8d1ad87d89b04aee
Showing with 24 additions and 0 deletions.
  1. +24 −0 chain-impl-mockchain/src/transaction/witness.rs
@@ -79,6 +79,29 @@ impl AsRef<[u8]> for WitnessAccountData {
}
}

pub struct WitnessMultisigData(Vec<u8>);

impl WitnessMultisigData {
pub fn new(
block0: &HeaderHash,
transaction_id: &TransactionId,
spending_counter: &account::SpendingCounter,
) -> Self {
let mut v = Vec::with_capacity(65);
v.push(WITNESS_TAG_MULTISIG);
v.extend_from_slice(block0.as_ref());
v.extend_from_slice(transaction_id.as_ref());
v.extend_from_slice(&spending_counter.to_bytes());
Self(v)
}
}

impl AsRef<[u8]> for WitnessMultisigData {
fn as_ref(&self) -> &[u8] {
self.0.as_ref()
}
}

impl Witness {
/// Creates new `Witness` value.
pub fn new_utxo(
@@ -124,6 +147,7 @@ impl Witness {
const WITNESS_TAG_OLDUTXO: u8 = 0u8;
const WITNESS_TAG_UTXO: u8 = 1u8;
const WITNESS_TAG_ACCOUNT: u8 = 2u8;
const WITNESS_TAG_MULTISIG: u8 = 3u8;

impl property::Serialize for Witness {
type Error = std::io::Error;

0 comments on commit b7b97a6

Please sign in to comment.
You can’t perform that action at this time.