Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't submit failed transactions to the mempool #64

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/api/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this was a last minute change made to accommodate an exchange, and still uses this weird async construction and sending structure. Would you like to make this change as part of this MR @DaMatrix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do

// simply pass the transaction in as an argument
let (peer, tx) = self.next_payment.take().unwrap();

debug!(
Expand Down
Loading