Fix panic causable by remote node

This commit is contained in:
Luke Parker 2023-07-24 02:53:54 -04:00
parent 8e6e05ae2d
commit 9ac3b203c8
No known key found for this signature in database

View file

@ -201,8 +201,11 @@ impl SpendableOutput {
&mut self,
rpc: &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(())
}