Bitcoin Forum
May 28, 2024, 04:22:36 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Adding RPC Commands to bitcoind - cannot convert input  (Read 1582 times)
XertroV (OP)
Member
**
Offline Offline

Activity: 88
Merit: 12

Max Kaye


View Profile WWW
May 03, 2013, 10:34:08 AM
Last edit: May 03, 2013, 10:47:40 AM by XertroV
 #1

I'm attempting to add an RPC command to bitcoind. (createchaintradetx in this case)

(Code thus far: https://github.com/XertroV/bitcoin/commit/645c88d361a18c330845e5697ea9c817045bd452)

I'd like to convert one fo the input values, and it seems there's a lot of that done in bitcoinrpc.cpp in function RPCConvertValues.

I've added the line I presume I need:
Code:
if (strMethod == "createchaintradetx" && n > 5) ConvertTo<double>(params[5]);

However, I continue to recieve
Code:
error: {"code":-1,"message":"value is type str, expected real"}

I presume the conversion is failing. I've confirmed this with a previous RPC command I tried to add and had the same problem.

Does anyone know why this is failing? I've grepped through for other function names (such as createrawtransaction) and can't find other references to them that would hint at what is needed to fix this.


Edit: as a testcase to produce the above error, if you clone the chaintrade branch linked above, you should be able to compile and run the following on testnet:
Code:
b-test createchaintradetx 7415e100520c4fc2de9429958c0b64500a076b48ef2ad0648c7243c52046c671 2102c1acc4dd7c5b43eee5626dbf0349095bfc85f16ce8dcf48025a0c0ef93c2644a 7415e100520c4fc2de9429958c0b64500a076b48ef2ad0648c7243c52046c671 2102c1acc4dd7c5b43eee5626dbf0349095bfc85f16ce8dcf48025a0c0ef93c2644a 5b50d05942cc2b5f65bbe4077e35e968cb743faad20910e02a26becf87e05f2a 1
Zeilap
Full Member
***
Offline Offline

Activity: 154
Merit: 100


View Profile
May 03, 2013, 06:12:37 PM
 #2

I suspect you're using a regular bitcoind to call your customized server. The vanilla client doesn't know about your new calls and so doesn't convert the values.

If you run your modified Qt client and open the debug console, you'll notice the command works just fine.
XertroV (OP)
Member
**
Offline Offline

Activity: 88
Merit: 12

Max Kaye


View Profile WWW
May 04, 2013, 12:48:04 AM
 #3

Cheers Zeilap,

That seems to have fixed the issue. I'd presumed the conversion was done when bitcoind received the RPC command, not when it was sent. The more you know!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!