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

listsinceblock lists additional transactions in category send #273

Open
arnuschky opened this issue May 13, 2015 · 7 comments
Open

listsinceblock lists additional transactions in category send #273

arnuschky opened this issue May 13, 2015 · 7 comments
Assignees
Labels

Comments

@arnuschky
Copy link

So, this is the bug I've mentioned in #263: listsinceblock lists additional transactions that are not present in the bitcoin core result.

I now realized that all additional transactions reported have the category send even when they haven't been sent from an address in the local wallet. Sorry for not spotting this earlier, but this seems to be a real bug (TM).

Example transaction: http://tbtc.blockr.io/tx/info/0154b341c081a35c316554e1f628919232bbf3769e4ca63188997200b1e5bee7
migiScBNvVKYwEiCFhgBNGtZ87cdygtuSQ is in the wallet, all others are not. btcd correctly returns the receive transaction, but also lists it again as a send.

@jrick
Copy link
Member

jrick commented May 13, 2015

I checked on the various block explorers and that address currently has a "balance" of zero (addresses don't have balances, but bear with me), so for every received output in the recv category (or immature, generate, etc.) there should also be a send category, since it was included as an input in another transaction.

@jrick
Copy link
Member

jrick commented May 13, 2015

Were all the redeeming transactions created by the same wallet? Because btcwallet will still create results in the "send" category when any output is redeemed, even if it did not author and send the transaction.

@arnuschky
Copy link
Author

For every outgoing transaction, btcwallet also lists a 'send' transaction that matches the data of the input spend.

Example:

"transactions": [
    {
      "account": "",
      "address": "mgHzfpfrn1T5dKWACJBcbrGF63PZiguX1W",
      "amount": -0.02,
      "category": "send",
      "confirmations": -1,
      "fee": 0,
      "time": 1431562566,
      "timereceived": 1431562566,
      "txid": "d7e2b041353c57ac39612ac9edd8600e6392757f1e27734f1308c5ae4a3e3965",
      "vout": 0,
      "walletconflicts": []
    },
    {
      "account": "",
      "address": "mgHzfpfrn1T5dKWACJBcbrGF63PZiguX1W",
      "amount": 0.02,
      "category": "receive",
      "confirmations": -1,
      "time": 1431562566,
      "timereceived": 1431562566,
      "txid": "d7e2b041353c57ac39612ac9edd8600e6392757f1e27734f1308c5ae4a3e3965",
      "vout": 0,
      "walletconflicts": []
    },
   ...
]

The second item is the output towards a wallet address, listed as 'receive transaction'. This is correct and also given by bitcoin core. The first item is the wrong 'spend transaction' that appears once the output given in the second item is spend.

Note that the values seem to be the same as for the second item, except an inverted amount and the category. This bug is independent from whether there is change towards the wallet or not. Also change to same or another address doesn't not affect this bug.

Maybe this helps.

@jrick
Copy link
Member

jrick commented May 14, 2015

I've gone back and took another look at how core is doing it, and I believe the added objects are the same but the order is different. In core, for each transaction, for each non-change output, if the transaction debits from the wallet, each output is added as sent, and then each received output is added as received. Our code is alternating between adding send and receive categories for each unspent output, instead of looping twice over the outputs.

@arnuschky
Copy link
Author

Sorry for late feedback, I was travelling. Any news on this? If I understand correctly, your last remark doesn't explain why there are additional objects in btcwallet's output, only why there's a different order, no?

@jrick
Copy link
Member

jrick commented May 21, 2015

I'm not yet sure why it's adding additional objects. I'll compare against bitcoind behavior later today.

@arnuschky
Copy link
Author

Let me know if I can help with anything.

@jrick jrick self-assigned this May 27, 2015
@jrick jrick added the json-rpc label Mar 17, 2016
buck54321 added a commit to buck54321/btcwallet that referenced this issue May 8, 2024
Remove duplicate NeutrinoClient interface
Merge btcsuite#265 cache+neutrino: add new cache module by @Roasbeef
Merge btcsuite#261 cache+neutrino: update existing Cache interface to use type parameters by @Roasbeef
Merge btcsuite#268 cache: add deletion and iteration methods by @yyforyongyu
Merge btcsuite#279 lru: add methods to range with orders by @yyforyongyu
Merge btcsuite#278 pushtx: map different backend err to internal err by @ziggie1984
Merge btcsuite#273 query+neutrino: use query dispatcher for GetBlock and GetCFilte by @ellemouton
Merge btcsuite#274 multi: introduce a batch filter writer by @ellemouton
Merge btcsuite#275 rescan: use batch filter fetching by @ellemouton
Merge btcsuite#283 blockmanager.go: use btcd libs to validate headers by @guggero
Merge btcsuite#288 neutrino: Added ResetRanking method to PeerRanking by @Chinwendu20
Merge btcsuite#293 & btcsuite#294 Fix typos by @vuittont60
Merge btcsuite#297 query: fix retry query case by @ziggie1984
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants