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

Add MakerToTakerMessagefor Invalid Swap Amounts #356

Open
KnowWhoami opened this issue Dec 31, 2024 · 0 comments
Open

Add MakerToTakerMessagefor Invalid Swap Amounts #356

KnowWhoami opened this issue Dec 31, 2024 · 0 comments
Labels
enhancement This enhances the code and improves stuffs
Milestone

Comments

@KnowWhoami
Copy link
Collaborator

if total_funding_amount >= self.config.min_size
&& total_funding_amount < self.wallet.read()?.store.offer_maxsize
{
log::info!(
"[{}] Total Funding Amount = {} | Funding Txids = {:?}",
self.config.port,
Amount::from_sat(total_funding_amount),
funding_txids
);
Ok(MakerToTakerMessage::RespContractSigsForSender(
ContractSigsForSender { sigs },
))
} else {
Err(MakerError::General("not enough funds"))

Whenever Maker gets ReqContractSigsForSender message from Taker and the send amount is not within the range of maker i.e (min_swap_amount, max_offersize) -> then we propagate the error which ultimately reaches to handle_client as shown:

if let Err(e) = handle_client(maker_for_handler, &mut stream, client_addr) {
log::error!("[{}] Error Handling client request {:?}", port, e);

which causes failure to handle client and maker recieves the log message that it fails to handle the client.
Though this wouldn't cause any damage to Maker but it is bad in terms of UX because It's the fault of Taker not Maker.

Proposed Solution:

  • Create a new MakerToTakerMessage variant which states about this situation that the send amount is not within the range of that Maker.
@KnowWhoami KnowWhoami added the enhancement This enhances the code and improves stuffs label Dec 31, 2024
@KnowWhoami KnowWhoami added this to the v0.1.1 milestone Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This enhances the code and improves stuffs
Projects
None yet
Development

No branches or pull requests

1 participant