caivega / ipfslib

Other
2 stars 1 forks source link

S3 - 同样使用已经使用过的sequence,不同的帐号会抛出不同的错误信息 #172

Closed foreso-GitHub closed 3 years ago

foreso-GitHub commented 3 years ago

不是很确定是否是bug,但感觉很奇怪。 同样使用已经使用过的sequence,不同的帐号会抛出不同的错误信息。 两个帐号都已经发送过sequence=1的交易,再次发送sequence=1的交易,得到不同的错误信息。 版本:v0.5.3-dev-20210111-04c8f9a27b4f9ae2e0f7a74c592a900f7d5d8575 TestCase:FCJT_sendTransaction_000650

帐号1
{
    "jsonrpc": "2.0",
    "method": "jt_sendTransaction",
    "params": [
        {
            "from": "jsQas6NmzVDGgpxKFeLE5LcGmC1467Y6EK",
            "secret": "sEdTTLmunxdDDhRhMXsjnjMe2TpdurU",
            "to": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
            "value": "1",
            "fee": "10",
            "memos": [
            ],
            "sequence": 1
        }
    ],
    "id": 1
}

{
    "error": {
        "count": 1,
        "description": "The compound error.",
        "information": "1 errors"
    },
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "error": {
                "description": "The exact transaction was already in this ledger.",
                "information": "The exact transaction was already in this ledger."
            },
            "status": -198,
            "type": "tefALREADY"
        }
    ],
    "status": 1000,
    "type": "tedCOMPOUND"
}
帐号2
{
    "jsonrpc": "2.0",
    "method": "jt_sendTransaction",
    "params": [
        {
            "from": "j4YFrLqcFukZ7fLT8TYpk98TBMfjVnX6z9",
            "secret": "snPghBkrdmZc82nAqaik8aMTKXmLP",
            "to": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
            "value": "1",
            "fee": "10",
            "memos": [
            ],
            "sequence": 1
        }
    ],
    "id": 1
}

{
    "error": {
        "count": 1,
        "description": "The compound error.",
        "information": "1 errors"
    },
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "error": {
                "description": "Malformed: Sequence is not in the past.",
                "information": "Malformed: Sequence is not in the past."
            },
            "status": -284,
            "type": "temBAD_SEQUENCE"
        }
    ],
    "status": 1000,
    "type": "tedCOMPOUND"
}
caivega commented 3 years ago

@foreso-GitHub 两个帐户第一次发送sequence=1时,最后交易是成功还是失败,返回啥结果?

现在对于已经发送过的处理,如果进入区块了,会返回tefALREADY,如果没有进入区块,进入缓存的中排队准备进区块的话,第二次发送会像新的一样处理,会报temBAD_SEQUENCE错误

foreso-GitHub commented 3 years ago

都是成功的。 两个交易的hash如下:

4F928037232A4F2E1AA09333E0ECB70701356718D0DBAF10CBDF95DAE5C52915
03125C14FD2ED9A39D66FC7CA8DF380E9536EC1259CBD97B87071ACDAC37F496
caivega commented 3 years ago

好的,那我这边改下逻辑,对于第二种情况,保留30秒的缓存时间,如果第二次再发送的话,就返回之前的处理结果,或者显示已经在缓存中的信息返回

foreso-GitHub commented 3 years ago

但可能03125C14FD2ED9A39D66FC7CA8DF380E9536EC1259CBD97B87071ACDAC37F496这个交易是你在更改这个功能前就已经发送了?这会不会导致目前不一致的情况?

caivega commented 3 years ago

还没有改,正在讨论,计划这么改,看看这样是否合理

caivega commented 3 years ago

想起来了,因为之前版本会默认每个交易会加一个TxFullyCanonicalSig(0x80000000)的flag(之前有一个bug报这个问题,所以就去掉了这个默认flag, 具体见 #167 ), 导致同一个sequence, 同样的amount的情况下,交易的hash不同,所以导致的处理结果不同

foreso-GitHub commented 3 years ago

这样的话重置链后这个问题就会消失。关闭问题。