forked from tornadocash/tornado-cli
Fix compliance, don't throw error if note isn't spent
This commit is contained in:
parent
78a357b164
commit
e92046a7ec
11
cli.js
11
cli.js
@ -1324,6 +1324,8 @@ async function loadWithdrawalData({ amount, currency, deposit }) {
|
|||||||
return event.nullifierHash === deposit.nullifierHex;
|
return event.nullifierHash === deposit.nullifierHex;
|
||||||
})[0];
|
})[0];
|
||||||
|
|
||||||
|
if (!withdrawEvent) return null;
|
||||||
|
|
||||||
const fee = withdrawEvent.fee;
|
const fee = withdrawEvent.fee;
|
||||||
const decimals = config.deployments[`netId${netId}`]['tokens'][currency].decimals;
|
const decimals = config.deployments[`netId${netId}`]['tokens'][currency].decimals;
|
||||||
const withdrawalAmount = toBN(fromDecimals({ amount, decimals })).sub(toBN(fee));
|
const withdrawalAmount = toBN(fromDecimals({ amount, decimals })).sub(toBN(fee));
|
||||||
@ -1417,8 +1419,8 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100', balanceC
|
|||||||
|
|
||||||
if (!isIpPrivate && !rpc.includes('localhost') && !privateRpc) {
|
if (!isIpPrivate && !rpc.includes('localhost') && !privateRpc) {
|
||||||
try {
|
try {
|
||||||
const htmlIPInfo = await axios.get("https://check.torproject.org", ipOptions);
|
const htmlIPInfo = await axios.get('https://check.torproject.org', ipOptions);
|
||||||
const ip = htmlIPInfo.data.split("Your IP address appears to be: <strong>").pop().split("</")[0];
|
const ip = htmlIPInfo.data.split('Your IP address appears to be: <strong>').pop().split('</')[0];
|
||||||
console.log('Your remote IP address is', ip);
|
console.log('Your remote IP address is', ip);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Could not fetch remote IP from check.torproject.org, use VPN if the problem repeats.');
|
console.error('Could not fetch remote IP from check.torproject.org, use VPN if the problem repeats.');
|
||||||
@ -1639,11 +1641,12 @@ async function main() {
|
|||||||
console.log('Transaction :', `https://${getExplorerLink()}/tx/${depositInfo.txHash}`);
|
console.log('Transaction :', `https://${getExplorerLink()}/tx/${depositInfo.txHash}`);
|
||||||
console.log('Commitment :', depositInfo.commitment);
|
console.log('Commitment :', depositInfo.commitment);
|
||||||
console.log('Spent :', depositInfo.isSpent);
|
console.log('Spent :', depositInfo.isSpent);
|
||||||
|
console.log('=====================================', '\n');
|
||||||
|
|
||||||
if (!depositInfo.isSpent) {
|
if (!depositInfo.isSpent) {
|
||||||
console.log('The note was not spent');
|
console.log('The note was not spent!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('=====================================', '\n');
|
|
||||||
|
|
||||||
const withdrawalDate = new Date(withdrawInfo.timestamp * 1000);
|
const withdrawalDate = new Date(withdrawInfo.timestamp * 1000);
|
||||||
console.log('\n=============Withdrawal==============');
|
console.log('\n=============Withdrawal==============');
|
||||||
|
Loading…
Reference in New Issue
Block a user