contract/money: Implement std::hash::Hash for OwnCoin

This commit is contained in:
parazyd
2024-02-08 12:05:40 +01:00
parent c7f287d4bd
commit 2f7c4b4e17

View File

@@ -26,6 +26,8 @@
//! the necessary objects provided by the caller. This is intentional, so we
//! are able to abstract away any wallet interfaces to client implementations.
use std::hash::{Hash, Hasher};
use darkfi_sdk::{
bridgetree,
crypto::{BaseBlind, Blind, FuncId, ScalarBlind, SecretKey},
@@ -103,6 +105,12 @@ pub struct OwnCoin {
pub leaf_position: bridgetree::Position,
}
impl Hash for OwnCoin {
fn hash<H: Hasher>(&self, state: &mut H) {
self.coin.inner().to_repr().hash(state);
}
}
pub fn compute_remainder_blind(
clear_inputs: &[crate::model::ClearInput],
input_blinds: &[ScalarBlind],