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

Error parsing boolean propriety "true" when run the fund command rpc #3048

Closed
vincenzopalazzo opened this issue Sep 11, 2019 · 12 comments
Closed

Comments

@vincenzopalazzo
Copy link
Collaborator

From documentation

announce is an optional flag that triggers whether to announce this channel or not. Defaults to true. An unannounced channel is considered private.

Issue and Steps to Reproduce

When go running the command RPC fundchannel with the optional boolean parameter I getting this error when run with "true"
This is the command request

{
  "id": 94,
  "method": "fundchannel",
  "params": {
    "satoshi": "10000",
    "minconf": "1",
    "id": "03ad9859fcbd6b821f1ee29d6d3c55883a5107588a668bf66dfddc71ca3dad1a4e",
    "announce": "true",
    "feerate": "normal"
  }
}

and I have this response

{
  "jsonrpc": 2.0,
  "id": 94,
  "error": {
    "code": -32602,
    "message": "\u0027announce\u0027 should be \u0027true\u0027 or \u0027false\u0027, not \u0027true\u0027"
  }
}

The response with my java exception is

Error when running the command FUNDCHANNEL.
Error inside command with error code: -32602
Message: 'announce' should be 'true' or 'false', not 'true'

getinfo output

{
   "id": "021bfe4fa81041a8d08dca2dcdf755a3ea19ad13070bc743f049ff5e227fa727e5",
   "alias": "YELLOWSUCKER",
   "color": "03ad98",
   "num_peers": 0,
   "num_pending_channels": 0,
   "num_active_channels": 0,
   "num_inactive_channels": 0,
   "address": [],
   "binding": [
      {
         "type": "ipv4",
         "address": "127.0.0.1",
         "port": 18880
      }
   ],
   "version": "v0.7.2.1",
   "blockheight": 600,
   "network": "regtest",
   "msatoshi_fees_collected": 0,
   "fees_collected_msat": "0msat",
   "warning_bitcoind_sync": "Bitcoind is not up-to-date with network."
}

@darosior
Copy link
Collaborator

Message: 'announce' should be 'true' or 'false', not 'true'

:-)

Can you try with https://github.com/darosior/lightning/tree/fix_fundchannel ?

@vincenzopalazzo
Copy link
Collaborator Author

Thanks, I'm finding inside the code this method for convert the value into json, so now I try your fix. :)

Thanks for simplifying my life with the C :)

Message: 'announce' should be 'true' or 'false', not 'true'

What? 😄

@darosior
Copy link
Collaborator

Message: 'announce' should be 'true' or 'false', not 'true'

What?

Do you get this error on my branch ?

@niftynei
Copy link
Collaborator

niftynei commented Sep 11, 2019

announce is parsed as a bool, not a string. you have it as a string here (in " quotes)

JSON string:

    "announce": "true",

JSON bool:

    "announce": true,

@darosior
Copy link
Collaborator

We could handle string too

@vincenzopalazzo
Copy link
Collaborator Author

vincenzopalazzo commented Sep 11, 2019

@darosior Sorry, I didn't have time to test your fix, tomorrow I will try it.

@niftynei Sorry, I had this problem while creating the RPC wrapper and I opened this issue to speak on the problem. I think is more simple handle the type with the node for more simplicity, no?

@niftynei
Copy link
Collaborator

niftynei commented Sep 11, 2019

the problem is in your JSON composer, not c-lightning. what are you using to generate this JSON?

can you post the fundchannel command you ran to get this error?

@darosior
Copy link
Collaborator

can you post the fundchannel command you ran to get this error?

He does a Java wrapper for the RPC call, that's why he posted the JSON.

@niftynei
Copy link
Collaborator

you should file an issue on the Java wrapper project, this is a bug on their end.

@vincenzopalazzo
Copy link
Collaborator Author

I'm sorry if I responding only now, but yesterday I wasn't in front of the PC.

So, I will recapitulation of this issue.

  1. I opened this issue not for a bug but for a question, I think this issue can be flag how enhancement
  2. How you said @niftynei the bug was inside my wrapper, the bug is simple to resolve, I'm using the Gson library.

I just wanted to ask a question and not to cause havoc here, I apologize.

ps: if the issue didn't not util, can be close it

@darosior
Copy link
Collaborator

I just wanted to ask a question and not to cause havoc here, I apologize.

It's ok, good to know that you solved it easily :-). I think this can be close then.

@vincenzopalazzo
Copy link
Collaborator Author

@darosior yes, I'm closing it

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

3 participants