Default descriptor
@@ -42,6 +42,12 @@ impl BlockChecksum {
}
}
+impl Default for BlockChecksum {
+ fn default() -> Self {
+ Self(0)
+ }
+}
+
impl From<BlockHash> for BlockChecksum {
fn from(block_hash: BlockHash) -> Self {
let mut xor: u8 = 0;
@@ -63,6 +69,12 @@ impl TxChecksum {
}
}
+impl Default for TxChecksum {
+ fn default() -> Self {
+ Self(0)
+ }
+}
+
impl From<Txid> for TxChecksum {
fn from(txid: Txid) -> Self {
let mut checksum: u64 = 0;
@@ -92,6 +104,12 @@ pub enum Dimension {
Input, Output
}
+impl Default for Descriptor {
+ fn default() -> Self {
+ Descriptor::OnchainBlock { block_height: 0, block_checksum: BlockChecksum::default() }
+ }
+}
+
impl Descriptor {
pub fn try_validity(&self) -> Result<(), Error> {
use Descriptor::*;
