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

Output spent in mempool not taken into account #759

Closed
arhuaco opened this issue Apr 15, 2015 · 17 comments
Closed

Output spent in mempool not taken into account #759

arhuaco opened this issue Apr 15, 2015 · 17 comments
Milestone

Comments

@arhuaco
Copy link

arhuaco commented Apr 15, 2015

I ran into a weird issue where sending an asset twice created the same raw transaction. The root cause is:

bitcoin-0.10.0/bin/bitcoin-cli searchrawtransactions ADDR

Returns outputs that are in the mempool, so they are (trying to be) spent but appear to be unspent to Counteparty.

Check this for an example: http://pastebin.com/ivLrnWcQ

I confirmed this happens both in testnet and regtest.

Why is this bad: It doesn't allow you to send more transactions until the current one is confirmed.

@deweller
Copy link
Contributor

Could be related to #757

@adamkrellenstein
Copy link
Member

Hm, interesting.

@adamkrellenstein
Copy link
Member

I'm about to go to sleep. @ouziel-slama, thoughts?

@arhuaco
Copy link
Author

arhuaco commented Apr 15, 2015

This hacky workaround fixes the issue for me: http://pastebin.com/G4Usp9u0

@ouziel-slama
Copy link
Contributor

@arhuaco : nice catch!
@deweller : yeah I think it's related to #757

Can you try please this patch: #760

@arhuaco
Copy link
Author

arhuaco commented Apr 16, 2015

@ouziel-slama: I could not cherry-pick the patches from master/HEAD. Could you please post the patch sequence to cherry-pick changes? (Probably including other changes).

I tried the develop branch but counterpartyd crashed. Here is the backtrace: http://pastebin.com/qGumU9nb

@ouziel-slama
Copy link
Contributor

@arhuaco: seems you get an asset conservation error. Just catch up mainnet database with the develop branch and works well. Can you try to reparse the database and then restart the server: counterparty-server reparse.

@arhuaco
Copy link
Author

arhuaco commented Apr 16, 2015

I deleted the XCP database (rm .local/share/counterparty/counterparty.testnet.db) and it started parsing blocks (starting with block 100). But it crashed.

It seems there is a coinbase transaction to an address where I had previously sent assets. I think this might be triggering the exception.

It crashed at block 117: http://pastebin.com/ycSWG5i7

Here are the block contents:

http://pastebin.com/Q7mbQFuY

@ouziel-slama
Copy link
Contributor

hum.. really weird, for testnet the first block is 310000.. are you running regnet instead testnet ?

@arhuaco
Copy link
Author

arhuaco commented Apr 16, 2015

Yes, I'm running regtest. But if this happens here it can probably happen in testnet/mainnet. But then in testnet it would be harder to reproduce the exception because to get a coinbase transaction you would have to mine a block.

Unlikely but could happen. Shall I open a new issue for this?

I will start from scratch just to test that the issue that we are dealing with is solved, and keep this docker image in case we want to test again later.

I'll report back soon. Testing...

@ouziel-slama
Copy link
Contributor

coinbase transactions are ignored and should not raise a bug (see here: https://github.com/CounterpartyXCP/counterpartyd/blob/develop/counterpartylib/lib/blocks.py#L549)...

@arhuaco
Copy link
Author

arhuaco commented Apr 16, 2015

I still see the issue: http://pastebin.com/8CtjJ3Ry

@arhuaco
Copy link
Author

arhuaco commented Apr 16, 2015

Branch "develop" worked in one of the testing environments, in the one I was using when I reported the issue. Maybe I did something wrong in the other test. I'll do it again and report back.

In any case, for it to work I had to apply this: http://pastebin.com/3N6gyzcn

The program crashes when the number of XCP held is 0 because held[asset] returns None.
I traced it after you told me that Coinbase TX was not the issue.

PS: There is a weird char after "issued" that cannot be encoded and makes Python crash. I deleted it in the fix I applied.

@ouziel-slama
Copy link
Contributor

@arhuaco: fixed here 88ef451
re-PS: check if your console is in UTF-8 (with locale for instance)

@arhuaco
Copy link
Author

arhuaco commented Apr 16, 2015

I confirm develop works: http://pastebin.com/cMnLJQFB

PS:

Yeah, my locale was wrong. Running 'perl' was revealing: http://pastebin.com/wZjGkXrr
I wonder how I got this far with this (inside of a docker image, not many programs running, only Counterparty complained).

@ouziel-slama
Copy link
Contributor

great! thanks for the feedback!

@adamkrellenstein
Copy link
Member

Seems this was solved.

@adamkrellenstein adamkrellenstein added this to the v9.51.1 milestone Apr 20, 2015
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

4 participants