mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
make happy path pass
This commit is contained in:
parent
d4f9acc1b1
commit
f9c03fa335
@ -101,7 +101,7 @@ where
|
|||||||
T: Serialize,
|
T: Serialize,
|
||||||
{
|
{
|
||||||
let bytes = serde_cbor::to_vec(&message)?;
|
let bytes = serde_cbor::to_vec(&message)?;
|
||||||
upgrade::write_one(substream, &bytes).await?;
|
upgrade::write_with_len_prefix(substream, &bytes).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -444,8 +444,13 @@ where
|
|||||||
Self::Error,
|
Self::Error,
|
||||||
>,
|
>,
|
||||||
> {
|
> {
|
||||||
|
if let Some(event) = self.events.pop_front() {
|
||||||
|
return Poll::Ready(ProtocolsHandlerEvent::Custom(event));
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(result) = futures::ready!(self.inbound_stream.poll_unpin(cx)) {
|
if let Some(result) = futures::ready!(self.inbound_stream.poll_unpin(cx)) {
|
||||||
self.keep_alive = KeepAlive::No;
|
self.keep_alive = KeepAlive::No;
|
||||||
|
self.inbound_stream = OptionFuture::from(None);
|
||||||
return Poll::Ready(ProtocolsHandlerEvent::Custom(HandlerOutEvent::Completed(
|
return Poll::Ready(ProtocolsHandlerEvent::Custom(HandlerOutEvent::Completed(
|
||||||
result,
|
result,
|
||||||
)));
|
)));
|
||||||
@ -478,17 +483,17 @@ pub enum Error {
|
|||||||
},
|
},
|
||||||
#[error("Failed to fetch latest rate")]
|
#[error("Failed to fetch latest rate")]
|
||||||
LatestRateFetchFailed(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
|
LatestRateFetchFailed(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
|
||||||
#[error("Failed to calculate quote: {0}")]
|
#[error("Failed to calculate quote")]
|
||||||
SellQuoteCalculationFailed(#[source] anyhow::Error),
|
SellQuoteCalculationFailed(#[source] anyhow::Error),
|
||||||
#[error("Blockchain networks did not match, we are on {asb:?}, but request from {cli:?}")]
|
#[error("Blockchain networks did not match, we are on {asb:?}, but request from {cli:?}")]
|
||||||
BlockchainNetworkMismatch {
|
BlockchainNetworkMismatch {
|
||||||
cli: BlockchainNetwork,
|
cli: BlockchainNetwork,
|
||||||
asb: BlockchainNetwork,
|
asb: BlockchainNetwork,
|
||||||
},
|
},
|
||||||
#[error("Io Error: {0}")]
|
#[error("Io Error")]
|
||||||
Io(anyhow::Error),
|
Io(#[source] anyhow::Error),
|
||||||
#[error("Failed to request wallet snapshot: {0}")]
|
#[error("Failed to request wallet snapshot")]
|
||||||
WalletSnapshotFailed(anyhow::Error),
|
WalletSnapshotFailed(#[source] anyhow::Error),
|
||||||
#[error("Failed to complete execution setup within {seconds}s")]
|
#[error("Failed to complete execution setup within {seconds}s")]
|
||||||
Timeout { seconds: u64 },
|
Timeout { seconds: u64 },
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,7 @@ impl ProtocolsHandler for Handler {
|
|||||||
|
|
||||||
if let Some(result) = futures::ready!(self.outbound_stream.poll_unpin(cx)) {
|
if let Some(result) = futures::ready!(self.outbound_stream.poll_unpin(cx)) {
|
||||||
self.keep_alive = KeepAlive::No;
|
self.keep_alive = KeepAlive::No;
|
||||||
|
self.outbound_stream = OptionFuture::from(None);
|
||||||
return Poll::Ready(ProtocolsHandlerEvent::Custom(Completed(result)));
|
return Poll::Ready(ProtocolsHandlerEvent::Custom(Completed(result)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user