atomicals / atomicals-electrumx

Electrumx Atomicals Indexer Server
MIT License
182 stars 56 forks source link

wrong atomicals block hash #90

Closed dubuqingfeng closed 4 months ago

dubuqingfeng commented 7 months ago

During our process of running the indexer, we have recently encountered some issues with mismatched atomicals block hashes

The phenomenon is as follows:

In the past two days, I have been running data from scratch. In version 1.3.7.5, starting from a certain height, the atomic block hash does not match with other nodes, nor does it match with third parties,

The other nodes were already running before.

The specific blocks and hash are as follows:

block height: 826309

tx hash: 14c04cda9d6ea6e84e0143871c9a8e495be346a428091555b6af72b1cb1d2a90

error hash:

        "826301": "d21c6a86c4c87318d4559cfc98400dcc0e4e68ed617b54d59c63c61d37f0aea3",
        "826302": "bdf18e69b983d1b07e299d53ddbeefbd64766719751072ff15b5af6f5afe3069",
        "826303": "ff4f604f9dbc3d507a257044dc7d47b7185dd38a4c5e6ec6edfff864c6abed94",
        "826304": "832a3a89d21aaf532130e005657c58374e8ec7ec0b9f3c28d3370edb89391915",
        "826305": "c566edd568c532e7f28b7366eed3697202acdb25802765af1dcef85fd0df9905",
        "826306": "4de7739d67d9cfaf65e6b68f470e1c74b252bc9f92c37ec49c4fead5e1fac8c1",
        "826307": "fc89e4f23463ce31ebe4ff21deaafad941d22117b7e11d3392e890ca49b097ed",
        "826308": "91c084528b61d722e9869d49db3022c2936090a55a3f6fc46eab43d430d7a6c5",
        **"826309": "6510639a449461bc0fd43c741cdc5b5f1cfab65a1c3bd7c0db77bc9dc5855584",**
        "826310": "6959756a4106bb719ac942255b16bd491b9724d05ab272c0a7b0aaf27650eb8a",
        "826311": "b074f0a42b966b7ad7c42b47693ee20ba876f94bc0b065299333b8857b5e27b6",
        "826312": "50061ffef80d9c80980dbd82a8544f71d53469fa50f19a10f25f6ee413c46dff",
        "826313": "ccc9688b86f1437aaf9f17e9b60bcae1f4a0b10a12cb891155b9ae60326e4632",
        "826314": "2e065ce92a71ccbe5c527dd78d05f55a5c5a2caa8e1d8d850afa72b5f97b3327",
        "826315": "0e206b8052cec401b7f207c72c63cda9bd2dd9a14d85ec3f466518bf40772349",

normal:

"826304": "832a3a89d21aaf532130e005657c58374e8ec7ec0b9f3c28d3370edb89391915",
"826305": "c566edd568c532e7f28b7366eed3697202acdb25802765af1dcef85fd0df9905",
"826306": "4de7739d67d9cfaf65e6b68f470e1c74b252bc9f92c37ec49c4fead5e1fac8c1",
"826307": "fc89e4f23463ce31ebe4ff21deaafad941d22117b7e11d3392e890ca49b097ed",
"826308": "91c084528b61d722e9869d49db3022c2936090a55a3f6fc46eab43d430d7a6c5",
**"826309": "6cf66e08c81fbca2639fd624a6bb5c5ead2bf177c730c2b19527eb02e7697bb4",**
"826310": "ec5615f9a80ac9b259559b71d65f778763528f8093f3c3b0a6b77db50f1c2228",
"826311": "71f8af8aeea8860073ffd2f5955d35d586d865d9b1c2ffdaa62ed2090fae7018",
"826312": "c70a7bc0722d6faccbd28218efb61211a98023cafbf91b4083df4483845d3447",
"826313": "b03a3cb32156ffb2835cbe5bbfb2b8347829c55eb2ef4f076b4438fc7abeed2e",
"826314": "11b13a1acf13846487055d16905bbf2718f09993e93db40b8f050c9d34956016",
"826315": "deec42e1f9744a6eec440296e479962b71720870b2bd05bcc60faa3a391072ca",

normal: 6cf66e08c81fbca2639fd624a6bb5c5ead2bf177c730c2b19527eb02e7697bb4 error: 6510639a449461bc0fd43c741cdc5b5f1cfab65a1c3bd7c0db77bc9dc5855584

txhash log:

1848961-atomicals-electrumx-server  | INFO:BlockProcessor:get_expected_dmitem_payment_info: not found_parent_mint_info found_atomical_id_for_potential_dmitem=b'\xf7\x89#\xc8\xfc(\x03(\x98\xef\xe7\xaf\x99+\xcf\xe2\xa7A\xcaz,\x86p\xfe\x9f\xa8\xe6\x0e\xa6j\x88\x88\x00\x00\x00\x00'
1848962:atomicals-electrumx-server  | WARNING:BlockProcessor:create_or_delete_dmitem_payment_output_if_valid: 14c04cda9d6ea6e84e0143871c9a8e495be346a428091555b6af72b1cb1d2a90 NOT MATCHED PRICE - create_or_delete_dmitem_payment_output_if_valid found_atomical_id_for_potential_dmitem 88886aa60ee6a89ffe70862c7aca41a7e2cf2b99afe7ef98280328fcc82389f7i0
shadowv0vshadow commented 7 months ago
# Save the atomicals hash for the current block
current_height_atomicals_block_hash = self.coin.header_hash(b''.join(concatenation_of_tx_hashes_with_valid_atomical_operation))
put_general_data(b'tt' + pack_le_uint32(height), current_height_atomicals_block_hash)
self.logger.info(f'height={height}, atomicals_block_hash={hash_to_hex_str(current_height_atomicals_block_hash)}')   

Atomicals block hash generate by all of the concatenation_of_tx_hashes_with_valid_atomical_operation in this height, from the log, It seems found_parent_mint_info get error caused this wrong. I will try to fix it.

AlexV525 commented 4 months ago

Should be fixed by https://github.com/atomicals/atomicals-electrumx/pull/180.