CounterpartyXCP / counterparty-core

Counterparty Protocol Reference Implementation
http://counterparty.io
MIT License
284 stars 206 forks source link

`create_send` hangs; `not published in blockchain` API error #571

Closed cryptodock closed 9 years ago

cryptodock commented 9 years ago

Running Counterpartyd v9.49.3, get_balances api function works properly but when doing create_send counterpartyd hangs and shows no errors , nothing in logs either , bitcoind becomes unresponsive as well, running the fork with addrindex , any ideas ?

adamkrellenstein commented 9 years ago

@cryptodock, does the problem not occur with v9.49.3? In what versions is it present?

adamkrellenstein commented 9 years ago

Also, would you try running bitcoind with -rpcthreads=10 to see if that changes anything?

cryptodock commented 9 years ago

@adamkrellenstein, it happens with v9.49.3, running bitcoind with "-rpcthreads=10" seems to be solving the problem, however is it safe to assume that the problem won't repeat itself in production ?

btcdrak commented 9 years ago

For ClearingHouse we have the following settings in the viacoind.conf

rpcthreads=1000
rpctimeout=300
cryptodock commented 9 years ago

@btcdrak, thank you, will try that!

cryptodock commented 9 years ago

Well it seems like problem continues, even with rpcthreads=1000, every now and then I also receive this error:

ERROR] API Exception: {'message': 'Public key for address ‘1Dgd6YuNRcaypMf7t6krXpY9R9QYYuWF8n’ not published in blockchain.', 'args': ('Public key for address ‘1Dgd6YuNRcaypMf7t6krXpY9R9QYYuWF8n’ not published in blockchain.',), 'type': 'AddressError'}

cryptodock commented 9 years ago

Traceback (most recent call last): File "/home/bitcoin/counterpartyd_build/env/lib/python3.4/site-packages/jsonrpc/manager.py", line 89, in _get_responses result = method(_request.args, *_request.kwargs) File "/home/bitcoin/counterpartyd_build/dist/counterpartyd/lib/api.py", line 428, in create_method return compose_transaction(db, self.proxy, name=tx, params=transaction_args, **common_args) File "/home/bitcoin/counterpartyd_build/dist/counterpartyd/lib/api.py", line 275, in compose_transaction fee_provided=fee_provided) File "/home/bitcoin/counterpartyd_build/dist/counterpartyd/lib/transaction.py", line 390, in construct provided_pubkeys, encoding) File "/home/bitcoin/counterpartyd_build/dist/counterpartyd/lib/transaction.py", line 79, in get_dust_return_pubkey dust_return_pubkey_hex = backend.pubkeyhash_to_pubkey(proxy, source, provided_pubkeys) File "/home/bitcoin/counterpartyd_build/dist/counterpartyd/lib/backend.py", line 274, in pubkeyhash_to_pubkey raise script.AddressError('Public key for address ‘{}’ not published in blockchain.'.format(pubkeyhash)) lib.script.AddressError: Public key for address ‘1Dgd6YuNRcaypMf7t6krXpY9R9QYYuWF8n’ not published in blockchain.

cryptodock commented 9 years ago

changing encoding to "opreturn" seems to be fixing the problem, but both source and destination addresses belong to same Bitcoin walllet so no reason "multisig" encoding won't work or I am wrong ?

adamkrellenstein commented 9 years ago

Are the problematic addresses the sources or destinations (or both)? The problematic addresses are in your wallet, correct?

cryptodock commented 9 years ago

@adamkrellenstein , both in my wallet

adamkrellenstein commented 9 years ago

Right, so we didn't mean to make this regression, but thinking about it, it's probably better to leave it in there (for architectural reasons).

The thing for you to do is to get the pubkey of the source address from bitcoind using the validateaddress API call, and pass that to the counterpartyd API in the pubkey param. Let me know if you have a problem doing that.

cryptodock commented 9 years ago

@adamkrellenstein problem persists when using validateaddress and specifying pubkey param. create_send hangs, no errors what so ever ( using encoding = 'multisig') what do to ?

adamkrellenstein commented 9 years ago

The hanging error is totally separate from the "not published in blockchain" problem. I thought that the former was fixed with -rpcthreads=?

cryptodock commented 9 years ago

Hanging problem is still there, I thought it was fixed with rpcthreads as well looks like it isn't, one query of 20 to create_send works, others just hang without any error

I added the following to bitcoin.conf as btcdrak suggested: rpcthreads=1000 rpctimeout=300

adamkrellenstein commented 9 years ago

@cryptodock, while we look into it, try playing around with those settings to see if that helps at all.

adamkrellenstein commented 9 years ago

Also, what versions do you have the problem with?

cryptodock commented 9 years ago

Looks like it was hanging because counterpartyd was reparsing last block from blockchain, if I leave it for 5 minute and then do create_send it works.

Thanks everyone, now everything works just fine.