Skip to content

Commit

Permalink
fix(settlement): Return Settlement Engine ILP Address instead of conn…
Browse files Browse the repository at this point in the history
…ector's ILP address when return a reject at the message service
  • Loading branch information
gakonst committed Jul 20, 2019
1 parent 53ddf70 commit 2ba3633
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/interledger-settlement/src/message_service.rs
Expand Up @@ -45,10 +45,8 @@ where
fn handle_request(&mut self, request: IncomingRequest<A>) -> Self::Future {
// Only handle the request if the destination address matches the ILP address
// of the settlement engine being used for this account
let ilp_address = self.ilp_address.clone();
if let Some(settlement_engine_details) = request.from.settlement_engine_details() {
if request.prepare.destination() == SE_ILP_ADDRESS.clone() {
let ilp_address_clone = self.ilp_address.clone();
let mut settlement_engine_url = settlement_engine_details.url;
// The `Prepare` packet's data was sent by the peer's settlement
// engine so we assume it is in a format that our settlement engine
Expand Down Expand Up @@ -80,7 +78,7 @@ where
code: ErrorCode::T00_INTERNAL_ERROR,
message: b"Error sending message to settlement engine",
data: &[],
triggered_by: Some(&ilp_address_clone),
triggered_by: Some(&SE_ILP_ADDRESS),
}.build()
})
.and_then(move |response| {
Expand All @@ -92,7 +90,7 @@ where
code: ErrorCode::T00_INTERNAL_ERROR,
message: b"Error getting settlement engine response",
data: &[],
triggered_by: Some(&ilp_address),
triggered_by: Some(&SE_ILP_ADDRESS),
}.build()
})
.and_then(|body| {
Expand All @@ -112,7 +110,7 @@ where
code,
message: format!("Settlement engine rejected request with error code: {}", response.status()).as_str().as_ref(),
data: &[],
triggered_by: Some(&ilp_address),
triggered_by: Some(&SE_ILP_ADDRESS),
}.build()))
}
}));
Expand Down

0 comments on commit 2ba3633

Please sign in to comment.