dao-exec: input value blind should be the sum of blinds used for input value commits

This commit is contained in:
x
2023-02-08 02:17:34 +01:00
parent 90f3a0fea7
commit 5b90347d46

View File

@@ -406,7 +406,6 @@ impl Drk {
let user_coin_blind = pallas::Base::random(&mut OsRng);
let dao_serial = pallas::Base::random(&mut OsRng);
let dao_coin_blind = pallas::Base::random(&mut OsRng);
let input_value_blind = pallas::Scalar::random(&mut OsRng);
// TODO: FIXME: Clean this up and create an API
let exec_signature_secret = SecretKey::random(&mut OsRng);
@@ -414,7 +413,6 @@ impl Drk {
let mut xfer_inputs = vec![];
let mut input_coins = vec![];
let mut input_value_blinds = vec![];
let mut input_amount = 0;
for coin in coins {
input_amount += coin.note.value;
@@ -427,6 +425,7 @@ impl Drk {
let money_merkle_tree = self.get_money_tree().await?;
let money_merkle_root = money_merkle_tree.root(0).unwrap();
let mut input_value_blind = pallas::Scalar::from(0);
for coin in &input_coins {
let value_blind = pallas::Scalar::random(&mut OsRng);
let sig_secret = SecretKey::random(&mut OsRng);
@@ -444,7 +443,7 @@ impl Drk {
signature_secret: sig_secret,
});
input_value_blinds.push(value_blind);
input_value_blind += value_blind;
}
let input_sum = input_coins.iter().map(|x| x.note.value).sum::<u64>();