-
Notifications
You must be signed in to change notification settings - Fork 110
fix(receive): block new addresses during rescan #1367
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ import { Button } from '@/components/ui/button' | |
| import { Card, CardContent } from '@/components/ui/card' | ||
| import PageTitle from '@/components/ui/jam/PageTitle' | ||
| import { Skeleton } from '@/components/ui/skeleton' | ||
| import { useRescanStatus } from '@/context/JamSessionInfoContext' | ||
| import { useJars } from '@/context/JamWalletInfoContext' | ||
| import { useApiClient } from '@/hooks/useApiClient' | ||
| import { withMutationDelay } from '@/lib/queryClient' | ||
|
|
@@ -34,6 +35,7 @@ interface ReceivePageProps { | |
| export const ReceivePage = ({ walletFileName }: ReceivePageProps) => { | ||
| const { t } = useTranslation() | ||
| const { jars } = useJars() | ||
| const { rescanInfo } = useRescanStatus() | ||
|
|
||
| const [selectedSourceJarIndex, setSelectedSourceJarIndex] = useState(jars.length > 0 ? jars[0].jarIndex : undefined) | ||
| const [amount, setAmount] = useState<AmountSats>() | ||
|
|
@@ -107,6 +109,7 @@ export const ReceivePage = ({ walletFileName }: ReceivePageProps) => { | |
| } | ||
|
|
||
| const fetchNewAddress = async () => { | ||
| if (rescanInfo.rescanning) return | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be removed or externalized into a variable (e.g. e.g. imho this might also be true if the maker is running, since collaborative tx outputs come from purpose "receive" ( Is that taken care of in joinmarket-ng (maker does not use address already shown to the user and vice versa) @m0wer ? |
||
| await getAddressMutation.mutateAsync() | ||
| } | ||
|
|
||
|
|
@@ -132,7 +135,7 @@ export const ReceivePage = ({ walletFileName }: ReceivePageProps) => { | |
| variant={jarButtonVariant(selectedSourceJarIndex)} | ||
| size="lg" | ||
| onClick={() => void fetchNewAddress()} | ||
| disabled={getAddressMutation.isPending} | ||
| disabled={getAddressMutation.isPending || rescanInfo.rescanning} | ||
| > | ||
| <HatGlassesIcon /> | ||
| {t('receive.button_reveal_address')} | ||
|
|
@@ -189,7 +192,11 @@ export const ReceivePage = ({ walletFileName }: ReceivePageProps) => { | |
| </div> | ||
|
|
||
| <div className="mt-4 flex flex-wrap items-center justify-center gap-2"> | ||
| <Button variant="outline" onClick={() => void fetchNewAddress()} disabled={getAddressMutation.isPending}> | ||
| <Button | ||
| variant="outline" | ||
| onClick={() => void fetchNewAddress()} | ||
| disabled={getAddressMutation.isPending || rescanInfo.rescanning} | ||
| > | ||
| {getAddressMutation.isPending ? ( | ||
| <> | ||
| <RefreshCwIcon className="animate-spin motion-reduce:hidden" /> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.