on master help sign in
Merge pull request #192 from urbit/unhappy-fixes

Small unhappy-path fixes

commit81a795bef4cb8bbaa744c1a849e14de43dba103a authorFang <Fang-@users.noreply.github.com> dateMon 15 Jul 2019, 20:49 (7 years ago) parent903f3544449f00
2 files changed+13−6
src/lib/txn.js+11−6 src/views/Activate/ActivateCode.js+2
src/lib/txn.js+11−6
@@ -165,11 +165,16 @@ const sendSignedTransaction = (web3, stx, doubtNonceError, confirmationCb) => {
165165 // that it's because the tank already submitted our transaction.
166166 // we just wait for first confirmation here.
167167 console.error(err);
168− if (
169− doubtNonceError &&
170− (err.message || '').includes("the tx doesn't have the correct nonce.")
171− ) {
172− console.log('nonce error, likely from gas tank submission, ignoring');
168+ const isKnownError = (err.message || '').includes(
169+ 'known transaction: '
170+ );
171+ const isNonceError = (err.message || '').includes(
172+ "the tx doesn't have the correct nonce."
173+ );
174+ if (isKnownError || (doubtNonceError && isNonceError)) {
175+ console.log(
176+ 'tx send error likely from gas tank submission, ignoring'
177+ );
173178 const txHash = web3.utils.keccak256(rawTx);
174179 //TODO can we do does-exists check first?
175180 //TODO max wait time before assume fail?
@@ -182,7 +187,7 @@ const sendSignedTransaction = (web3, stx, doubtNonceError, confirmationCb) => {
182187 }
183188 });
184189 } else {
185− reject(err.message);
190+ reject(err.message || 'Transaction sending failed!');
186191 }
187192 });
188193 });
src/views/Activate/ActivateCode.js+2
@@ -93,6 +93,8 @@ export default function ActivateCode() {
9393 'This invite code has multiple points available.\n' +
9494 "Once you've activated this point, activate the next with the same process."
9595 );
96+ } else {
97+ setGeneralError(false);
9698 }
9799 } else {
98100 setGeneralError(