|
|
@ -3,7 +3,9 @@ use crate::bitcoin::{
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use ::bitcoin::{util::psbt::PartiallySignedTransaction, OutPoint, TxIn, TxOut, Txid};
|
|
|
|
use ::bitcoin::{util::psbt::PartiallySignedTransaction, OutPoint, TxIn, TxOut, Txid};
|
|
|
|
use anyhow::Result;
|
|
|
|
use anyhow::Result;
|
|
|
|
|
|
|
|
use ecdsa_fun::fun::Point;
|
|
|
|
use miniscript::{Descriptor, DescriptorTrait};
|
|
|
|
use miniscript::{Descriptor, DescriptorTrait};
|
|
|
|
|
|
|
|
use rand::thread_rng;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
|
@ -42,6 +44,16 @@ impl TxLock {
|
|
|
|
OutPoint::new(self.txid(), self.lock_output_vout() as u32)
|
|
|
|
OutPoint::new(self.txid(), self.lock_output_vout() as u32)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Calculate the size of the script used by this transaction.
|
|
|
|
|
|
|
|
pub fn script_size() -> usize {
|
|
|
|
|
|
|
|
build_shared_output_descriptor(
|
|
|
|
|
|
|
|
Point::random(&mut thread_rng()),
|
|
|
|
|
|
|
|
Point::random(&mut thread_rng()),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.script_pubkey()
|
|
|
|
|
|
|
|
.len()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Retreive the index of the locked output in the transaction outputs
|
|
|
|
/// Retreive the index of the locked output in the transaction outputs
|
|
|
|
/// vector
|
|
|
|
/// vector
|
|
|
|
fn lock_output_vout(&self) -> usize {
|
|
|
|
fn lock_output_vout(&self) -> usize {
|
|
|
|