NebulousLabs / Sia

Blockchain-based marketplace for file storage. Project has moved to GitLab: https://gitlab.com/NebulousLabs/Sia
https://sia.tech
MIT License
2.71k stars 440 forks source link

API returns invalid list of transactions #2765

Open devfive opened 6 years ago

devfive commented 6 years ago

BUG REPORT

When I do a call to retrieve wallet transactions starting from block N to K, I retrieve invalid list of transactions, for example:

1.

curl -X GET \
  'http://192.168.1.12:9980/wallet/transactions?startheight=141379&endheight=1500000' \
  -H 'user-agent: Sia-Agent' \

gives me:

{
    "confirmedtransactions": null,
    "unconfirmedtransactions": []
}

2.

curl -X GET \
  'http://192.168.1.12:9980/wallet/transactions?startheight=140000&endheight=1500000' \
  -H 'user-agent: Sia-Agent' \

gives me:

{
    "confirmedtransactions": [
        // ... some transactions here
        {
            // ... txdata
            "transactionid": "XXX",
            "confirmationheight": 141380,
        }
    ],
    "unconfirmedtransactions": []
}

Stack Trace or error message no error message

Expected Behavior Both calls should return list containing transaction with txid XXX (as on example 2).

How to reproduce it (as minimally and precisely as possible) Don't really know - I suppose it may be connected with another issue I observed - wallet and consensus are not synchronised equally, for example currently my consensus is on block 141687, but when I try to retrieve transactions for that block from my wallet I get following error:

{
    "message": "error when calling /wallet/transactions: requesting transactions at unknown confirmation heights"
}

Currently my wallet can retrieve transactions up to block 141667, so it is 20 blocks behind consensus.

Environment

algerpan commented 6 years ago

same problem here, anyone can help?

ChrisSchinnerl commented 6 years ago

@algerpan @devfive We have had a bug that caused the wallet to miss updates from the consensus set. That means sometimes the results of the transactions endpoint are of by multiples of 10 blocks. It was fixed in 1.3.3 though but to fix this issue on an existing wallet you can't just upgrade but you need to do a clean reinstall.

algerpan commented 6 years ago

Hi @ChrisSchinnerl, thanks for your advice. what kind level of reinstall you mean here? saying download binary file again and run it?

ChrisSchinnerl commented 6 years ago

You need to delete the data directory too before installing 1.3.3. Steve wrote a guide for this. Just make sure you have your seed backed up so you can import it after Sia is reinstalled.

MSevey commented 6 years ago

@devfive @algerpan if either of you have done the clean reinstall for v1.3.3, can you confirm if you were able to reproduce the bug still? If not we can close this issue.