feat(txbuilder): compute ScriptDataHash including edge cases (#525)
Co-authored-by: kalomaaan <kalomaaan@gmail.com>
This commit is contained in:
parent
061a7796d6
commit
698d7a4933
9 changed files with 282 additions and 94 deletions
|
|
@ -232,6 +232,14 @@ where
|
|||
pub fn to_vec(self) -> Vec<(K, V)> {
|
||||
self.into()
|
||||
}
|
||||
|
||||
pub fn from_vec(x: Vec<(K, V)>) -> Option<Self> {
|
||||
if x.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(NonEmptyKeyValuePairs::Def(x))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V> From<NonEmptyKeyValuePairs<K, V>> for Vec<(K, V)>
|
||||
|
|
@ -777,6 +785,14 @@ impl<T> NonEmptySet<T> {
|
|||
pub fn to_vec(self) -> Vec<T> {
|
||||
self.0
|
||||
}
|
||||
|
||||
pub fn from_vec(x: Vec<T>) -> Option<Self> {
|
||||
if x.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(Self(x))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Deref for NonEmptySet<T> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue