pub(crate) mod crypto;
+/// Extension of the bitcoin::io module
pub mod io {
pub use bitcoin::io::*;
Current(i64),
}
+ /// Emulation of std::io::Cursor
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct Cursor<T> {
inner: T,
}, |msg_type: u64, msg_reader: &mut FixedLengthReader<_>| -> Result<bool, DecodeError> {
if msg_type < 1 << 16 { return Ok(false) }
let mut value = Vec::new();
- msg_reader.read_to_end(&mut value)?;
+ // msg_reader.read_to_end(&mut value)?;
+ msg_reader.read_to_limit(&mut value, u64::MAX)?;
custom_tlvs.push((msg_type, value));
Ok(true)
});
}
let mut bytes = Vec::new();
- r.read_to_end(&mut bytes).unwrap();
+ // r.read_to_end(&mut bytes).unwrap();
+ r.read_to_limit(&mut bytes, u64::MAX).unwrap();
match Self::parse(tlv_type, bytes) {
Ok(message) => Ok(message),
.unwrap()[..]
);
let local_delayedsig = EcdsaSignature {
- sig: sign_with_aux_rand(secp_ctx, &sighash, &delayed_payment_key, &self),
- hash_ty: EcdsaSighashType::All,
+ signature: sign_with_aux_rand(secp_ctx, &sighash, &delayed_payment_key, &self),
+ sighash_type: EcdsaSighashType::All,
};
let payment_script =
bitcoin::Address::p2wsh(&witness_script, Network::Bitcoin).script_pubkey();
};
let pubkey = Xpub::from_priv(&secp_ctx, &secret).to_pub();
if derivation_idx == 2 {
- assert_eq!(pubkey.inner, self.shutdown_pubkey);
+ assert_eq!(pubkey.0, self.shutdown_pubkey);
}
let witness_script =
bitcoin::Address::p2pkh(&pubkey, Network::Testnet).script_pubkey();
let payment_script = bitcoin::Address::p2wpkh(&pubkey, Network::Testnet)
- .expect("uncompressed key found")
.script_pubkey();
if payment_script != output.script_pubkey {
let mut sig_ser = sig.serialize_der().to_vec();
sig_ser.push(EcdsaSighashType::All as u8);
let witness =
- Witness::from_slice(&[&sig_ser, &pubkey.inner.serialize().to_vec()]);
+ Witness::from_slice(&[&sig_ser, &pubkey.0.serialize().to_vec()]);
psbt.inputs[input_idx].final_script_witness = Some(witness);
},
}