-Coin icon indicating copy to clipboard operation
-Coin copied to clipboard

500 Code Sent Back From Daemon

Open dcrdev opened this issue 9 years ago • 4 comments

With PHP 5.6 and Bitcoin 0.10.0, +Coin is sending incorrect headers to bitcoind resulting in an 500 response. I beleive this may be down to recent changes in PHP 5.6 which means that cookies are being sent with fopen by default now. I could be wrong but I don't know much about the bitcoind RPC spec.

dcrdev avatar Mar 01 '15 15:03 dcrdev

That's extremely strange. It uses the well-known JSONRPC library used by almost every daemon-based web application, are you sure it's headers? Bitcoin will return a 500 for a lot of reasons, often being you sending the wrong data type (i.e. string instead of float), or because it's still synchronizing the blockchain.

Someguy123 avatar Mar 01 '15 15:03 Someguy123

I modified the code a bit changing line 141 to: throw new exception('Request error: '.$response['error']['code'].' - '.$response['error']['message']);

To get a more specific response back: I'm only getting this "'Request error: Array" so it seems the json getting sent is malformed in some way (or at least bitcoind thinks so).

dcrdev avatar Mar 01 '15 15:03 dcrdev

Yeah, not sure what to do here. the JSONRPC library would be to blame here. It's worked on 5.4 and 5.5 previously without any issues, but this was also with older versions of Bitcoin, not sure if their RPC spec changed in some way too...

If you can figure it out and submit a pull request (without breaking older versions of PHP...), I'd be happy to accept it.

Someguy123 avatar Mar 01 '15 15:03 Someguy123

Got the same issue. Had to fix in 'index.php' lines 11-12 from null to "*"

$bal = $nmc->getbalance("*", 3);
$bal3 = $nmc->getbalance("*", 0);

BTW, fixed to 3 confirmations as it enough to make further transactions ;)

LazyGatto avatar Jun 03 '15 08:06 LazyGatto