Add conditions to the signature to reject duplicates
This commit is contained in:
parent
94daf4cea4
commit
e759bd1a99
|
@ -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) {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue