Skip to content

Commit 1dea48a

Browse files
authored
Merge pull request #1131 from benthecarman/lsps1-refund-address-validation
Reject LSPS1 orders with the wrong refund address
2 parents 179b4b2 + 6b07d50 commit 1dea48a

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎src/liquidity/client/lsps1.rs‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ where
157157
request_id = client_handler.create_order(
158158
&lsps1_node.node_id,
159159
order_params.clone(),
160-
Some(refund_address),
160+
Some(refund_address.clone()),
161161
);
162162
PendingRequestGuard::insert(
163163
&self.pending_create_order_requests,
@@ -189,6 +189,20 @@ where
189189
return Err(Error::LiquidityRequestFailed);
190190
}
191191

192+
if let Some(received_refund_address) = response
193+
.payment_options
194+
.onchain
195+
.as_ref()
196+
.and_then(|o| o.refund_onchain_address.as_ref())
197+
.filter(|addr| addr.script_pubkey() != refund_address.script_pubkey())
198+
{
199+
log_error!(
200+
self.logger,
201+
"Aborting LSPS1 request as LSP-provided refund address doesn't match our order. Expected: {}, Received: {}", refund_address, received_refund_address
202+
);
203+
return Err(Error::LiquidityRequestFailed);
204+
}
205+
192206
Ok(response)
193207
}
194208

0 commit comments

Comments
 (0)