kevacoin-project / kevacoin

Kevacoin source tree
https://www.kevacoin.org
MIT License
32 stars 16 forks source link

keva_filter returns error: couldn't parse reply from server #19

Open kevacoin-project opened 3 years ago

kevacoin-project commented 3 years ago

Steps to reproduce:

kevacoin-cli keva_group_filter NdwuyeGvKxX7yVU6Vf1qQ8Jp7XLp4dP1Wo

The command returns the following error message:

error: couldn't parse reply from server
kevacoin-project commented 3 years ago

This is triggered by the new protocol used in Kevacoin mobile app.

The title(key) of reply/share/reward starts with byte 0x00, then followed by 0x01 (reply), 0x02(share), 0x03(reward), and finally the txid (in binary format). This is to save the key size. The txid is 32 byte long if it is in binary format, while it is about 44 bytes in Base64 format.

This binary string makes the JSON result invalid and causes the above error message.

What we can do is to add detection of key format. If it is a valid UTF-8 string, we display the string as before. Otherwise we display it as a hex string. For example:

"key": "000104ed782eda93..."

The problem how we can know if the string is a hex string, or a UTF-8 string?

One possible solution is to introduce a new option field encode:

"key": "000104ed782eda93...",
"encode": "hex"

The default decoding is utf8 if encode is not specified.

kawww commented 3 years ago

App better first if this is good for app.

Pc just do what app do is ok.