diff --git a/src/api/handlers.rs b/src/api/handlers.rs index 034e021..44543e9 100644 --- a/src/api/handlers.rs +++ b/src/api/handlers.rs @@ -561,6 +561,10 @@ pub async fn post_make_payment( .await .map_err(|e| map_string_err(r.clone(), e, StatusCode::INTERNAL_SERVER_ERROR))?; + if !response.success { + return r.into_err_internal(ApiErrorType::Generic(response.reason)); + } + let request = UserRequest::UserApi(UserApiRequest::SendNextPayment); if let Err(e) = peer.inject_next_event(peer.local_address(), request) { error!("route:make_payment error: {:?}", e); diff --git a/src/user.rs b/src/user.rs index 4b7381b..b14f568 100644 --- a/src/user.rs +++ b/src/user.rs @@ -852,6 +852,8 @@ impl UserNode { &mut self, mempool_peer: SocketAddr, ) -> Result<()> { + // TODO: having next_payment as part of the node is error-prone, it would be better to + // simply pass the transaction in as an argument let (peer, tx) = self.next_payment.take().unwrap(); debug!(