Add conditions to the signature to reject duplicates

This commit is contained in:
Greg Fitzgerald 2018-03-07 23:37:16 -07:00
parent 94daf4cea4
commit e759bd1a99
2 changed files with 9 additions and 1 deletions

View File

@ -118,6 +118,7 @@ impl Accountant {
if !tr.if_all.is_empty() { if !tr.if_all.is_empty() {
self.pending.insert(tr.sig, tr.clone()); self.pending.insert(tr.sig, tr.clone());
return Ok(());
} }
if self.balances.contains_key(&tr.to) { if self.balances.contains_key(&tr.to) {

View File

@ -60,7 +60,14 @@ impl<T: Serialize> Transaction<T> {
} }
fn get_sign_data(&self) -> Vec<u8> { fn get_sign_data(&self) -> Vec<u8> {
serialize(&(&self.from, &self.to, &self.asset, &self.last_id)).unwrap() serialize(&(
&self.from,
&self.to,
&self.if_all,
&self.unless_any,
&self.asset,
&self.last_id,
)).unwrap()
} }
pub fn sign(&mut self, keypair: &KeyPair) { pub fn sign(&mut self, keypair: &KeyPair) {