filter duplicate commitments

This commit is contained in:
scilio
2022-04-27 16:30:15 -04:00
parent 8cf41e4730
commit bff59b08ac
4 changed files with 60 additions and 26 deletions
+6
View File
@@ -24,6 +24,12 @@ pub trait GrinNode : Send + Sync {
fn post_tx(&self, tx: &Transaction) -> Result<()>;
}
/// Checks if a commitment is in the UTXO set
pub fn is_unspent(node: &Arc<dyn GrinNode>, commit: &Commitment) -> Result<bool> {
let utxo = node.get_utxo(&commit)?;
Ok(utxo.is_some())
}
/// Checks whether a commitment is spendable at the block height provided
pub fn is_spendable(node: &Arc<dyn GrinNode>, output_commit: &Commitment, next_block_height: u64) -> Result<bool> {
let output = node.get_utxo(&output_commit)?;