Skip to content

Commit de82b59

Browse files
committed
Add BlockHeader::clear_witness method
1 parent e53ec31 commit de82b59

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/block.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,20 @@ impl BlockHeader {
234234
false
235235
}
236236
}
237+
238+
/// Remove the witness data of the block header.
239+
/// This is all the data that can be removed without changing
240+
/// the block hash.
241+
pub fn clear_witness(&mut self) {
242+
match &mut self.ext {
243+
&mut ExtData::Proof { ref mut solution, .. } => {
244+
*solution = Script::new();
245+
},
246+
&mut ExtData::Dynafed { ref mut signblock_witness, .. } => {
247+
signblock_witness.clear();
248+
},
249+
}
250+
}
237251
}
238252

239253
impl Encodable for BlockHeader {

0 commit comments

Comments
 (0)