Skip to content
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

Token transfer transaction failed but marked as success #2860

Closed
surindergiri opened this issue May 30, 2019 · 1 comment
Closed

Token transfer transaction failed but marked as success #2860

surindergiri opened this issue May 30, 2019 · 1 comment

Comments

@surindergiri
Copy link

surindergiri commented May 30, 2019

Hi,

confirmed-tx-details.txt
confirmed-but-failed-txt-details.txt

Description

I'm not able to distinguish between two transactions, both are successful but 2nd one is actually failed by ethereum later.

  1. Tx status is "success" and tokens transferred:
    https://etherscan.io/tx/0xdb93c83d526ee74f011bba06e5358989510802f283c073f7329e221db7e47126

  2. Tx status is "success" and but tokens not transferred (its a double spending tx):
    https://etherscan.io/tx/0xd6b4496575531167c8d434c51aac39cfa24bfbfaae98295ff44481b63175700f

User successfully initiated two parallel transactions of same token amount , 1st transaction got mined successfully and tokens sent to other user, the 2nd one is also mined and marked status as "success", but actually it is a double spending transaction so its not marked as "failed" by blockchain.

When I fetch transaction details and transaction receipt for both above transactions from blockchain, I'm getting status "success" for both, which is a bit weird and web3 tx details and tx receipt functions doesn't return any specific status for 2nd tx (which is actually failed but with status success) .The only difference between two transactions details is the "log" details, is it good to mark a transaction failed if its TransactionReceipt log field is empty?

Expected behavior

Web3 functions TransactionDetails or TransactionReceipt should return some specific status for transactions which are with status "success" but actually failed (please refer to tx no. 2)

Actual behavior

Web3 functions TransactionDetails or TransactionReceipt returning status "success" for both transactions, but actually 2nd tx is failed (please refer to tx no. 2)

Steps to reproduce the behavior

Example:
1. Import `web3`
2. Set the provider to `mainnet`
3. Fetch transaction details and transaction receipt for both above transactions.
4. You will get status "success" for both transactions, but actually 2nd tx is failed.

Please use the code blocks Markdown does provide:
var transaction = await this.web3.eth.getTransaction(tx_id);
console.log(transaction);
var getTransactionReceipt = await this.web3.eth.getTransactionReceipt(tx_id);
console.log(getTransactionReceipt);

Versions

  • web3.js: ^1.0.0-beta.55
  • nodejs: v10.15.3
  • ethereum node: Infura Mainnet

Thanks,
Surinder kumar

@nivida
Copy link
Contributor

nivida commented May 31, 2019

Your contract does return false and doesn't have a require who is reverting the transaction this is the reason why the transaction has the status true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants