Skip to content

Commit

Permalink
Add Script:dust_value() to get minimum output value for a spk
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlueMatt committed Feb 5, 2021
1 parent cf45a61 commit cba9c5b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/blockdata/script.rs
Expand Up @@ -325,6 +325,16 @@ impl Script {
opcodes::All::from(self.0[0]).classify() == opcodes::Class::IllegalOp)
}

/// Gets the minimum value an output with this script should have in order to be
/// broadcastable on today's bitcoin network.
pub fn dust_value() {
if self.is_witness_program() {
294
} else {
546
}
}

/// Iterate over the script in the form of `Instruction`s, which are an enum covering
/// opcodes, datapushes and errors. At most one error will be returned and then the
/// iterator will end. To instead iterate over the script as sequence of bytes, treat
Expand Down

0 comments on commit cba9c5b

Please sign in to comment.