Fix master key invoice as well.

This commit is contained in:
finned-palmer 2021-09-06 13:03:38 -05:00
parent eb5d026df4
commit 3b35df4620

View File

@ -59,9 +59,11 @@ const Invoice: React.FC<Props> = ({ stopSending, payee, satsAmount }) => {
broadcastSuccess,
network,
denomination,
history,
} = useSettings();
const [masterTicket, setMasterTicket] = useState('');
const [ready, setReady] = useState(false);
const [historyLength, setHistoryLength] = useState(0);
const [localError, setLocalError] = useState(error);
const [broadcasting, setBroadcasting] = useState(false);
@ -78,6 +80,16 @@ const Invoice: React.FC<Props> = ({ stopSending, payee, satsAmount }) => {
return api.btcWalletCommand(command);
};
useEffect(() => {
if (historyLength === 0) {
setHistoryLength(history.length);
}
if (broadcasting && history.length > historyLength) {
setBroadcasting(false);
stopSending();
}
}, [history]);
const sendBitcoin = (ticket: string, psbt: string) => {
const newPsbt = bitcoin.Psbt.fromBase64(psbt);
setBroadcasting(true);