caivega / ipfslib

Other
2 stars 1 forks source link

S3 - 发送代币,某些特定的value发送总是失败 #155

Closed foreso-GitHub closed 3 years ago

foreso-GitHub commented 3 years ago

发送代币,某些特定的value发送总是失败。比如decimals为8,9.00000001或者10.00000001发送总是失败。

value为9.00000001,请求:

{
    "jsonrpc": "2.0",
    "id": 6,
    "method": "jt_sendTransaction",
    "params": [
        {
            "from": "jNqebWJbSohU9qtUkL8qtG5eZWVwrJFSzZ",
            "secret": "ssCojFG4ezm51zTjxXXdMqqLwC9ju",
            "to": "jniDykG3nP3HuHAiWJhqvLyvTVjPWr2Yse",
            "value": "9.00000001/5fe32a22/jjjjjjjjjjjjjjjjjjjjjhoLvTp",
            "fee": "10",
            "memos": [
                "autotest: token test"
            ]
        }
    ]
}

结果失败:

{
    "error": "1 errors",
    "id": 6,
    "jsonrpc": "2.0",
    "result": [
        {
            "error": "error value value",
            "message": {
                "fee": "10",
                "from": "jNqebWJbSohU9qtUkL8qtG5eZWVwrJFSzZ",
                "memos": [
                    "autotest: token test"
                ],
                "to": "jniDykG3nP3HuHAiWJhqvLyvTVjPWr2Yse",
                "value": "9.00000001/5fe32a22/jjjjjjjjjjjjjjjjjjjjjhoLvTp"
            },
            "status": -278,
            "type": "temINVALID"
        }
    ],
    "status": -278,
    "type": "temINVALID"
}

把value改为9.00000011,请求:

{
    "jsonrpc": "2.0",
    "id": 6,
    "method": "jt_sendTransaction",
    "params": [
        {
            "from": "jNqebWJbSohU9qtUkL8qtG5eZWVwrJFSzZ",
            "secret": "ssCojFG4ezm51zTjxXXdMqqLwC9ju",
            "to": "jniDykG3nP3HuHAiWJhqvLyvTVjPWr2Yse",
            "value": "9.00000011/5fe32a22/jjjjjjjjjjjjjjjjjjjjjhoLvTp",
            "fee": "10",
            "memos": [
                "autotest: token test"
            ]
        }
    ]
}

结果成功:

{
    "id": 6,
    "jsonrpc": "2.0",
    "result": [
        "B722D18FD868BE7CA90FD557616D1673B368C27DA1C57F9B52978B5A3A8388B7"
    ]
}
foreso-GitHub commented 3 years ago

TestCase:

caivega commented 3 years ago

已修复,下一个build验证

foreso-GitHub commented 3 years ago

在版本v0.5.3-dev-20201229-549e506fdf4556bc9bfd675559fd201421bd3036中验证,已经修复。