[−][src]Enum lnpbp::bp::scripts::Strategy
Defines strategy for converting some source Bitcoin script (i.e.
LockScript) into both scriptPubkey
and sigScript
/witness
fields
Variants (Non-exhaustive)
The script or public key gets right into scriptPubkey
, i.e. as
P2PK (for a public key) or as custom script (mostly used for
OP_RETURN
)
We hash public key or script and use non-SegWit scriptPubkey
encoding, i.e. P2PKH or P2SH with corresponding non-segwit
transaction input sigScript
containing copy of LockScript in
redeemScript
field
Compatibility variant for SegWit outputs when the SegWit version and
program are encoded as RedeemScript in sigScript
transaction input
field, while the original public key or WitnessScript are stored in
witness
. scriptPubkey
contains a normal P2SH composed agains
the redeemScript
from sigScript
(P2SH-P2WPKH and P2SH-P2WSH
variants).
This type works with any witness version, including taproot.
We produce either P2WPKH or P2WSH output and use witness field in transaction input to store the original LockScript or the public key
Will be used for Taproot
Implementations
impl Strategy
[src]
pub fn deduce(
pubkey_script: &PubkeyScript,
has_witness: Option<bool>
) -> Result<Strategy, StrategyError>
[src]
pubkey_script: &PubkeyScript,
has_witness: Option<bool>
) -> Result<Strategy, StrategyError>
Deduction of [ConversionStrategy] from a scriptPubkey
data and,
optionally, information about the presence of the witness for P2SH
scriptPubkey
's.
Arguments
pubkey_script
- script from transaction outputscriptPubkey
has_witness
- an optionalbool
with the following meaning:None
: witness presence must be determined from thepubkey_script
value; don't use it for P2SHscriptPubkey
s, otherwise the method will return [ConversionStrategyError::IncompleteInformation] error.Some(true)
: presence of a witness structure will be required in transaction input to spend the givenpubkey_script
, i.e. it was composed with P2SH-P2W*H schemeSome(false)
: ifscriptPubkey
is P2SH, it is a "normal" P2SH and was not created with P2SH-P2W*H scheme. The spending transaction input would not havewitness
structure.
Errors
The function may [ConversionStrategyError] in the following cases
IncompleteInformation
: the provided pubkey script (pubkey_script
argument) is P2SH script, andhas_witness
argument was set toNone
(see explanation about the argument usage above).UnsupportedWitnessVersion(WitnessVersion)
: the provided pubkey script has a witness version above 1.
Trait Implementations
impl Clone for Strategy
[src]
impl Copy for Strategy
[src]
impl Debug for Strategy
[src]
impl Display for Strategy
[src]
impl Eq for Strategy
[src]
impl Hash for Strategy
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Strategy> for Strategy
[src]
impl StructuralEq for Strategy
[src]
impl StructuralPartialEq for Strategy
[src]
Auto Trait Implementations
impl RefUnwindSafe for Strategy
impl Send for Strategy
impl Sync for Strategy
impl Unpin for Strategy
impl UnwindSafe for Strategy
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,