Allow offsetting FROST keys multiple times

This commit is contained in:
Luke Parker 2022-05-14 15:04:08 -04:00
parent 3f02ab3037
commit dcd909a839
No known key found for this signature in database
GPG key ID: F9F1386DB1E119B6

View file

@ -239,7 +239,10 @@ pub struct MultisigKeys<C: Curve> {
impl<C: Curve> MultisigKeys<C> {
pub fn offset(&self, offset: C::F) -> MultisigKeys<C> {
let mut res = self.clone();
res.offset = Some(offset);
// Carry any existing offset
// Enables schemes like Monero's subaddresses which have a per-subaddress offset and then a
// one-time-key offset
res.offset = Some(offset + res.offset.unwrap_or(C::F::zero()));
res
}