adshares / ads

ADS Blockchain
Other
21 stars 4 forks source link

transaction with "empty" type #108

Closed PawelPodkalicki closed 6 years ago

PawelPodkalicki commented 6 years ago

During get_message tests I got messages with transaction of type empty. Is it correct type?

Response for get_message

{
    "current_block_time": "1530530656",
    "previous_block_time": "1530530624",
    "tx": {
        "data": "1A010000000000730B3A5B400A3A5B02007B0000002A222C3D424EF1A147C93DF9BA94969DBF4A2C5DAE030C3297AA8663EE98F5E6C4D34688414CBDFB48D677ED38F70DEFADC8F0A40A5B4B8E5A04D14EBA11770A"
    },
    "node": "2",
    "node_msid": "123",
    "time": "1530530389",
    "length": "89",
    "hash": "4573042B60EE464DF615BAE94E29558BE7118579AA18D2859BDEF1D36E84E463",
    "transactions": [{
            "id": "0002:0000007B:0001",
            "type": "empty",
            "message_length": "16777220",
            "size": "16777220"
        }
    ]
}

Please, note that message length for transaction changes. First response for get_transaction 0002:0000007B:0001

{
    "current_block_time": "1530530976",
    "previous_block_time": "1530530944",
    "tx": {
        "data": "14010000000000BB0C3A5B02007B00000001004F38CDF21C65C429972089BC79ACBC7A45D32D73C7FBB7A51CACDE0D0CC686DD19F99A6706B0D4975F5CE2824C47A1317167BB43A39C3A0953F26C33E917F90B",
        "account_msid": "0",
        "account_hashin": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
        "account_hashout": "EF5448565BAB91A7AB76CB6ED069716919628F53E4BABBC4F41B2FE49D0DAC7B",
        "deduct": "0.00000000000",
        "fee": "0.00000000000"
    },
    "network_tx": {
        "id": "0002:0000007B:0001",
        "block_id": "1530530368",
        "node_id": "2",
        "node_msid": "123",
        "position": "1",
        "len": "4",
        "hash_path_len": "6",
        "hexstring": "",
        "hashpath": [
            "6C1AE50C57807C6631B5A02EA29761A723E422E503100FC2EE23F2D715D3A001",
            "49C9E2CFEE378AEE447C0EA6F9D15746F71E500A0263200C44E22551B97ECB0C",
            "3B6947C71F305D4BC99ECC23F91200F6A2BE16B26B242506E37E827DC85120E6",
            "B09BE91392C6B6BEEAA217362A1732A379FFEC7DA9A518AE539BA8E8B3BF0715",
            "4281C213D178DE9F9BCB126F1881D58236E17A765B0857CFF43A8EE4611F9724",
            "37391028F49186002F339DF34BFEA38D1666E0717584347C6C3352BBDEE82B66"
        ]
    },
    "txn": {
        "type": "empty",
        "message_length": "4244635652"
    }
}

Second response for get_transaction 0002:0000007B:0001

{
    "current_block_time": "1530531392",
    "previous_block_time": "1530531360",
    "tx": {
        "data": "14010000000000470E3A5B02007B0000000100FBA3DFB897C52262EA5F7744CAF89379A79EE32CDBDA11AE13187A3824EC02BF08BA0FB5E406466AAB20651622FAC3698B9A17AE76BE86F2BA0CFC4722043A02",
        "account_msid": "0",
        "account_hashin": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
        "account_hashout": "8C6005B2498ACCD5C2C2EBB048B0BD670BD4EC46962E7DFB744AEFAF71189EF7",
        "deduct": "0.00000000000",
        "fee": "0.00000000000"
    },
    "network_tx": {
        "id": "0002:0000007B:0001",
        "block_id": "1530530368",
        "node_id": "2",
        "node_msid": "123",
        "position": "1",
        "len": "4",
        "hash_path_len": "6",
        "hexstring": "00040000",
        "hashpath": [
            "6C1AE50C57807C6631B5A02EA29761A723E422E503100FC2EE23F2D715D3A001",
            "49C9E2CFEE378AEE447C0EA6F9D15746F71E500A0263200C44E22551B97ECB0C",
            "3B6947C71F305D4BC99ECC23F91200F6A2BE16B26B242506E37E827DC85120E6",
            "B09BE91392C6B6BEEAA217362A1732A379FFEC7DA9A518AE539BA8E8B3BF0715",
            "4281C213D178DE9F9BCB126F1881D58236E17A765B0857CFF43A8EE4611F9724",
            "37391028F49186002F339DF34BFEA38D1666E0717584347C6C3352BBDEE82B66"
        ]
    },
    "txn": {
        "type": "empty",
        "message_length": "4"
    }
}

Difference is in:

PawelPodkalicki commented 6 years ago

Type empty is correct. Invalid message length will be fixed.

PawelPodkalicki commented 6 years ago

Reason of invalid message is that message length takes 3 bytes, but is presented as 4 bytes value. Redundant byte has random data, what results in a bug.

PawelPodkalicki commented 6 years ago

message_length was deleted #123