From c165fd9341e5c08feb584515160b3a92863d20e5 Mon Sep 17 00:00:00 2001 From: scilio Date: Sat, 13 Aug 2022 13:39:54 -0400 Subject: [PATCH] removing redundant code --- src/rpc.rs | 1 - src/server.rs | 12 +++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/rpc.rs b/src/rpc.rs index 2dd1374..eac079b 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -114,7 +114,6 @@ pub fn listen( if secs == 0 { let _ = server.lock().unwrap().execute_round(); - secs = 0; } } }); diff --git a/src/server.rs b/src/server.rs index 724e445..ba20e9a 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1,7 +1,7 @@ use crate::config::ServerConfig; use crate::node::{self, GrinNode}; use crate::onion::Onion; -use crate::secp::{self, ComSignature, Commitment, RangeProof, Secp256k1, SecretKey}; +use crate::secp::{ComSignature, Commitment, RangeProof, Secp256k1, SecretKey}; use crate::wallet::{self, Wallet}; use grin_core::core::{Input, Output, OutputFeatures, TransactionBody}; @@ -137,16 +137,10 @@ impl Server for ServerImpl { }); } - // Calculate final output commitment - let output_commit = secp::add_excess(&onion.commit, &peeled.0.excess) - .map_err(|e| SwapError::UnknownError(e.to_string()))?; - let output_commit = secp::sub_value(&output_commit, fee) - .map_err(|e| SwapError::UnknownError(e.to_string()))?; - // Verify the bullet proof and build the final output if let Some(r) = peeled.0.rangeproof { let secp = Secp256k1::with_caps(secp256k1zkp::ContextFlag::Commit); - secp.verify_bullet_proof(output_commit, r, None) + secp.verify_bullet_proof(peeled.1.commit, r, None) .map_err(|_| SwapError::InvalidRangeproof)?; } else { // milestone 3: only the last hop will have a rangeproof @@ -164,7 +158,7 @@ impl Server for ServerImpl { onion.commit, Submission { excess: peeled.0.excess, - output_commit, + output_commit: peeled.1.commit, rangeproof: peeled.0.rangeproof, input, fee,