From 9ac3b203c86d745f8ce7df225db64bf16091bcc7 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Mon, 24 Jul 2023 02:53:54 -0400 Subject: [PATCH] Fix panic causable by remote node --- coins/monero/src/wallet/scan.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/coins/monero/src/wallet/scan.rs b/coins/monero/src/wallet/scan.rs index af325a63..86cd147b 100644 --- a/coins/monero/src/wallet/scan.rs +++ b/coins/monero/src/wallet/scan.rs @@ -201,8 +201,11 @@ impl SpendableOutput { &mut self, rpc: &Rpc, ) -> Result<(), RpcError> { - self.global_index = - rpc.get_o_indexes(self.output.absolute.tx).await?[usize::from(self.output.absolute.o)]; + self.global_index = *rpc + .get_o_indexes(self.output.absolute.tx) + .await? + .get(usize::from(self.output.absolute.o)) + .ok_or(RpcError::InvalidNode)?; Ok(()) }