Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ocean fix invalidate flow by reverse loop #3111

Merged

Conversation

canonbrother
Copy link
Contributor

Summary

Understand ocean-js object-like indexer (ScriptUnspentIndexer, TransactionIndexer..) vs ocean-rs task-like indexer (script, transaction..)

while tasklike indexer referring object-like indexer invalidation flow it happened txA was deleted at loop3 then cause error at loop4 while trying to that deleted txA
the object-like indexer (ScriptUnspentIndexer ) will ensure the whole particular task is done then move to TransactionIndexer so it won't cause error there
so fix to by reversing loop while invalidating in task-like indexer..

loop3 invalidate tx b2547c166179a771e86289c022e97c71d8cd04179477d56e39fb35e430b8b4a7
loop4 invalidate script dbc5861d11305273d614bc926e742126ee19f1283adfb83ce22394e7c0044f65 { 
  [vin: txid: b2547c166179a771e86289c022e97c71d8cd04179477d56e39fb35e430b8b4a7] <-- this txid was deleted at loop3
}

Ref logs:

2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0x7ae6c07ed3cba325666a5a15aa8415ae01827c121169ab90ba1c03b3ee8fbe3b, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0x3c73d1355d21893069c8a02a65871fa6028b45f0b029f968cacfd269d75f772a, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0xb2547c166179a771e86289c022e97c71d8cd04179477d56e39fb35e430b8b4a7, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0xdbc5861d11305273d614bc926e742126ee19f1283adfb83ce22394e7c0044f65, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0x0df0762f55f7b3749b23cadac7f800983fed63673d61cae758c6412ddc5ea28c, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0xee560d22b848812a967441cc87117b1a70095e460efa0b8f66838efc9f4c65bd, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0x0ceb48d99f694b3ed732a5f01a8dccb3f5f97d24e3e6a810c09ae0df88c5d0c9, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0xbd21450994cfb4ce2e8e4084e0be1ea3e919b1ee2a0b3847f8ff6d697f1a306b, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0x6886f4f720d39cf423af6568f1bbcdb523626d726637cb140104dbd638d1d06f, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0xf00d33182a8a611b837a211430577ae6defee1c563e93d7de638e6889bb7ed17, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0x6da9f6bc970cd098edc59796c36de52f2f7d75010ef7aa8b65f1f918c82810e2, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0xcf0d0242e4190ba66168e14c9b0fd8f27e1d33482b39d7639c9a931d88f269be, blockhash: 969578
2024-11-05T06:02:59Z [ain_ocean::indexer::transaction] Index transaction txid: 0x10ea8fb654c41216de25e5d1716f016311c538be4c9b191a37d322ce0998ddcd, blockhash: 969578
2024-11-05T06:03:00Z [ain_ocean::indexer::transaction] Index transaction txid: 0x36fb1c89217749e51a0ca268352e1d4a6012817813bdf003bad4a7c9f197eabc, blockhash: 969578
2024-11-05T06:03:00Z [ain_ocean::indexer::transaction] Index transaction txid: 0x7cd30ade263e2b4c370ef6ef18a0ef4d564698ae73c2577c314ee0143c93f5db, blockhash: 969578
2024-11-05T06:03:00Z [ain_ocean::indexer::transaction] Index transaction txid: 0xa620d876474e3bcac4ebf9bd78ddd6a113c221908b5ab170a76797b25550e04c, blockhash: 969578
2024-11-05T06:03:00Z [ain_ocean::indexer::transaction] Index transaction txid: 0x2630e5ec73cbee2ef2b7438fea3bb56b2dee2a9552014f24769b8185ac04a07a, blockhash: 969578
2024-11-05T06:03:00Z [ain_ocean::indexer::transaction] Index transaction txid: 0x2e44a7dcce5edd5256a9170ded092fc580ffd28aa23a0e4f1ea088ff0fdf2e2f, blockhash: 969578
2024-11-05T06:03:00Z [ain_ocean::indexer::transaction] Index transaction txid: 0xa72bf2392a97e7d878e639a5a918dcebeb3472651b33a7b454c7201722f2b5ea, blockhash: 969578
2024-11-05T06:03:00Z Error indexing block 969578 : NotFoundIndex { action: Index, type: "OracleHistory", id: "36fb1c89217749e51a0ca268352e1d4a6012817813bdf003bad4a7c9f197eabc" }
2024-11-05T06:03:00Z [ain_ocean::indexer] invalidate_script tx: Transaction { txid: 0x7ae6c07ed3cba325666a5a15aa8415ae01827c121169ab90ba1c03b3ee8fbe3b, hash: "3009e80868b91224a7fb3253455a6007753862d22e31c358f950ea33cb96f206", version: 4, size: 208, vsize: 181, weight: 724, locktime: 0, vin: [Coinbase(VinCoinbase { coinbase: "036acb0e00", sequence: 4294967295 })], vout: [Vout { value: 130.56034853, n: 0, script_pub_key: ScriptPubKey { asm: "OP_DUP OP_HASH160 493b7c514a94db8cc362d8c0199c75a972e5a482 OP_EQUALVERIFY OP_CHECKSIG", hex: [118, 169, 20, 73, 59, 124, 81, 74, 148, 219, 140, 195, 98, 216, 192, 25, 156, 117, 169, 114, 229, 164, 130, 136, 172], type: "pubkeyhash", req_sigs: Some(1), addresses: Some(["8Mm5K6HqTd9WcNWWXSuQdLFhnehF8qKteo"]) }, token_id: Some(0) }, Vout { value: 19.23346268, n: 1, script_pub_key: ScriptPubKey { asm: "OP_HASH160 dd7730517e0e4969b4e43677ff5bee682e53420a OP_EQUAL", hex: [169, 20, 221, 119, 48, 81, 126, 14, 73, 105, 180, 228, 54, 119, 255, 91, 238, 104, 46, 83, 66, 10, 135], type: "scripthash", req_sigs: Some(1), addresses: Some(["dZcHjYhKtEM88TtZLjp314H2xZjkztXtRc"]) }, token_id: Some(0) }, Vout { value: 0.0, n: 2, script_pub_key: ScriptPubKey { asm: "OP_RETURN aa21a9ed050f9703e5944c8181c287277d8e65eee63b3b3245f79746d31ff767d608b4da", hex: [106, 36, 170, 33, 169, 237, 5, 15, 151, 3, 229, 148, 76, 129, 129, 194, 135, 39, 125, 142, 101, 238, 230, 59, 59, 50, 69, 247, 151, 70, 211, 31, 247, 103, 214, 8, 180, 218], type: "nulldata", req_sigs: None, addresses: None }, token_id: Some(0) }], hex: "040000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff05036acb0e00ffffffff032548330a030000001976a914493b7c514a94db8cc362d8c0199c75a972e5a48288ac005cefa3720000000017a914dd7730517e0e4969b4e43677ff5bee682e53420a87000000000000000000266a24aa21a9ed050f9703e5944c8181c287277d8e65eee63b3b3245f79746d31ff767d608b4da000120000000000000000000000000000000000000000000000000000000000000000000000000" }
2024-11-05T06:03:00Z [ain_ocean::indexer::transaction] invalidate_transaction txid: 0x7ae6c07ed3cba325666a5a15aa8415ae01827c121169ab90ba1c03b3ee8fbe3b
2024-11-05T06:03:00Z [ain_ocean::indexer] invalidate_script tx: Transaction { txid: 0x3c73d1355d21893069c8a02a65871fa6028b45f0b029f968cacfd269d75f772a, hash: "de7d84feab388a8a169e7f15b33c823d64bc10d0d0c9d8a32e81cca59d848c6a", version: 4, size: 233, vsize: 152, weight: 605, locktime: 0, vin: [Standard(VinStandard { txid: 0x13e9a90bf4f00da2320ec45518cab8532faf20e8b967dc168d480189346d4b1e, vout: 0, script_sig: ScriptSig { asm: "00147810e82195885f6c06d2816db625e11354d98bbd", hex: Some("1600147810e82195885f6c06d2816db625e11354d98bbd") }, txinwitness: Some(["304402203865cfd01c8f444cc65e4cf833ae3dfa8d7a64590bbff1767cc358370e32f21b0220731581745ba205d94e62bc7bd07b56019711311e9d7902dbf837d7790cb057eb01", "02c4dd0567995a22763f3cf8578c793908bb48d0d1f20b218a63cddcca3347d76c"]), sequence: 4294967294 })], vout: [Vout { value: 0.0, n: 0, script_pub_key: ScriptPubKey { asm: "OP_RETURN 4466547841", hex: [106, 5, 68, 102, 84, 120, 65], type: "nulldata", req_sigs: None, addresses: None }, token_id: Some(0) }, Vout { value: 13.03759728, n: 1, script_pub_key: ScriptPubKey { asm: "OP_HASH160 990b4f2d928f6dfb98c812b485c54dc73434ac24 OP_EQUAL", hex: [169, 20, 153, 11, 79, 45, 146, 143, 109, 251, 152, 200, 18, 180, 133, 197, 77, 199, 52, 52, 172, 36, 135], type: "scripthash", req_sigs: Some(1), addresses: Some(["dTNWYuZ9NwdMimUEb7ifV3MHVdQU6vaqjm"]) }, token_id: Some(0) }], hex: "040000000001011e4b6d348901488d16dc67b9e820af2f53b8ca1855c40e32a20df0f40ba9e91300000000171600147810e82195885f6c06d2816db625e11354d98bbdfeffffff020000000000000000076a0544665478410070cbb54d0000000017a914990b4f2d928f6dfb98c812b485c54dc73434ac2487000247304402203865cfd01c8f444cc65e4cf833ae3dfa8d7a64590bbff1767cc358370e32f21b0220731581745ba205d94e62bc7bd07b56019711311e9d7902dbf837d7790cb057eb012102c4dd0567995a22763f3cf8578c793908bb48d0d1f20b218a63cddcca3347d76c00000000" }
2024-11-05T06:03:00Z [ain_ocean::indexer] invalidate_script_unspent_vin vin: VinStandard { txid: 0x13e9a90bf4f00da2320ec45518cab8532faf20e8b967dc168d480189346d4b1e, vout: 0, script_sig: ScriptSig { asm: "00147810e82195885f6c06d2816db625e11354d98bbd", hex: Some("1600147810e82195885f6c06d2816db625e11354d98bbd") }, txinwitness: Some(["304402203865cfd01c8f444cc65e4cf833ae3dfa8d7a64590bbff1767cc358370e32f21b0220731581745ba205d94e62bc7bd07b56019711311e9d7902dbf837d7790cb057eb01", "02c4dd0567995a22763f3cf8578c793908bb48d0d1f20b218a63cddcca3347d76c"]), sequence: 4294967294 }
2024-11-05T06:03:00Z [ain_ocean::indexer::transaction] invalidate_transaction txid: 0x3c73d1355d21893069c8a02a65871fa6028b45f0b029f968cacfd269d75f772a
2024-11-05T06:03:00Z [ain_ocean::indexer] invalidate_script tx: Transaction { txid: 0xb2547c166179a771e86289c022e97c71d8cd04179477d56e39fb35e430b8b4a7, hash: "74947fca5bc284e057ad65aaa9e89eccd799e95d9cdc7455e0ea72308c948a95", version: 4, size: 233, vsize: 152, weight: 605, locktime: 0, vin: [Standard(VinStandard { txid: 0x2fceb4026c57f8c878db6532f86c73f58952a5bd14b42ad743bb6b6a699ab96c, vout: 1, script_sig: ScriptSig { asm: "001455745036867cd2cbadc6cccba12ff7a138715089", hex: Some("16001455745036867cd2cbadc6cccba12ff7a138715089") }, txinwitness: Some(["3044022029aeeeac467bb0a83420a555899a935f0a700888210cd5da9153e864ed62e4f802204f520d1049fcc7adad5e04882ce7947527c383345784f9a854cf02db9442d22e01", "0346ac79473c7d22678c09181b854b10848ae71c598e84c9110137f8f5885a76d6"]), sequence: 4294967294 })], vout: [Vout { value: 0.0, n: 0, script_pub_key: ScriptPubKey { asm: "OP_RETURN 4466547841", hex: [106, 5, 68, 102, 84, 120, 65], type: "nulldata", req_sigs: None, addresses: None }, token_id: Some(0) }, Vout { value: 0.04343899, n: 1, script_pub_key: ScriptPubKey { asm: "OP_HASH160 dfe51d5a24930e1416e3e61c03f30ebd5956d2b5 OP_EQUAL", hex: [169, 20, 223, 229, 29, 90, 36, 147, 14, 20, 22, 227, 230, 28, 3, 243, 14, 189, 89, 86, 210, 181, 135], type: "scripthash", req_sigs: Some(1), addresses: Some(["dZq8miZFNNk2jbkqkNTHsVqhCSnK5iibXB"]) }, token_id: Some(0) }], hex: "040000000001016cb99a696a6bbb43d72ab414bda55289f5736cf83265db78c8f8576c02b4ce2f010000001716001455745036867cd2cbadc6cccba12ff7a138715089feffffff020000000000000000076a054466547841005b4842000000000017a914dfe51d5a24930e1416e3e61c03f30ebd5956d2b5870002473044022029aeeeac467bb0a83420a555899a935f0a700888210cd5da9153e864ed62e4f802204f520d1049fcc7adad5e04882ce7947527c383345784f9a854cf02db9442d22e01210346ac79473c7d22678c09181b854b10848ae71c598e84c9110137f8f5885a76d600000000" }
2024-11-05T06:03:00Z [ain_ocean::indexer] invalidate_script_unspent_vin vin: VinStandard { txid: 0x2fceb4026c57f8c878db6532f86c73f58952a5bd14b42ad743bb6b6a699ab96c, vout: 1, script_sig: ScriptSig { asm: "001455745036867cd2cbadc6cccba12ff7a138715089", hex: Some("16001455745036867cd2cbadc6cccba12ff7a138715089") }, txinwitness: Some(["3044022029aeeeac467bb0a83420a555899a935f0a700888210cd5da9153e864ed62e4f802204f520d1049fcc7adad5e04882ce7947527c383345784f9a854cf02db9442d22e01", "0346ac79473c7d22678c09181b854b10848ae71c598e84c9110137f8f5885a76d6"]), sequence: 4294967294 }
2024-11-05T06:03:00Z [ain_ocean::indexer::transaction] invalidate_transaction txid: 0xb2547c166179a771e86289c022e97c71d8cd04179477d56e39fb35e430b8b4a7
2024-11-05T06:03:00Z [ain_ocean::indexer] invalidate_script tx: Transaction { txid: 0xdbc5861d11305273d614bc926e742126ee19f1283adfb83ce22394e7c0044f65, hash: "77b9efb9236ceda157342dfe280e7007c5f40de7afc903f49a2eb07d59e274c7", version: 4, size: 295, vsize: 214, weight: 853, locktime: 0, vin: [Standard(VinStandard { txid: 0xb2547c166179a771e86289c022e97c71d8cd04179477d56e39fb35e430b8b4a7, vout: 1, script_sig: ScriptSig { asm: "001431d5d2c264b4b4633728b48241bd981a982d8fad", hex: Some("16001431d5d2c264b4b4633728b48241bd981a982d8fad") }, txinwitness: Some(["3044022061c0e008e31f2566edf116739c24debb0e4a88bb4cd0f7ed752771dd709bfca502204974d2c3eb869d8c0f8813128ff536dc078177c4cf6a6c1412636bb81ccbfd8d01", "02641741221fcf8af641aa1d232153c027da89d10ace5044ea79b6c2574432b392"]), sequence: 4294967295 })], vout: [Vout { value: 0.0, n: 0, script_pub_key: ScriptPubKey { asm: "OP_RETURN 446654784217a914dfe51d5a24930e1416e3e61c03f30ebd5956d2b5870117a914990b4f2d928f6dfb98c812b485c54dc73434ac248701030000001e01000000000000", hex: [106, 67, 68, 102, 84, 120, 66, 23, 169, 20, 223, 229, 29, 90, 36, 147, 14, 20, 22, 227, 230, 28, 3, 243, 14, 189, 89, 86, 210, 181, 135, 1, 23, 169, 20, 153, 11, 79, 45, 146, 143, 109, 251, 152, 200, 18, 180, 133, 197, 77, 199, 52, 52, 172, 36, 135, 1, 3, 0, 0, 0, 30, 1, 0, 0, 0, 0, 0, 0], type: "nulldata", req_sigs: None, addresses: None }, token_id: Some(0) }, Vout { value: 0.04334049, n: 1, script_pub_key: ScriptPubKey { asm: "OP_HASH160 dfe51d5a24930e1416e3e61c03f30ebd5956d2b5 OP_EQUAL", hex: [169, 20, 223, 229, 29, 90, 36, 147, 14, 20, 22, 227, 230, 28, 3, 243, 14, 189, 89, 86, 210, 181, 135], type: "scripthash", req_sigs: Some(1), addresses: Some(["dZq8miZFNNk2jbkqkNTHsVqhCSnK5iibXB"]) }, token_id: Some(0) }], hex: "04000000000101a7b4b830e435fb396ed577941704cdd8717ce922c08962e871a77961167c54b2010000001716001431d5d2c264b4b4633728b48241bd981a982d8fadffffffff020000000000000000456a43446654784217a914dfe51d5a24930e1416e3e61c03f30ebd5956d2b5870117a914990b4f2d928f6dfb98c812b485c54dc73434ac248701030000001e0100000000000000e12142000000000017a914dfe51d5a24930e1416e3e61c03f30ebd5956d2b5870002473044022061c0e008e31f2566edf116739c24debb0e4a88bb4cd0f7ed752771dd709bfca502204974d2c3eb869d8c0f8813128ff536dc078177c4cf6a6c1412636bb81ccbfd8d012102641741221fcf8af641aa1d232153c027da89d10ace5044ea79b6c2574432b39200000000" }
2024-11-05T06:03:00Z [ain_ocean::indexer] invalidate_script_unspent_vin vin: VinStandard { txid: 0xb2547c166179a771e86289c022e97c71d8cd04179477d56e39fb35e430b8b4a7, vout: 1, script_sig: ScriptSig { asm: "001431d5d2c264b4b4633728b48241bd981a982d8fad", hex: Some("16001431d5d2c264b4b4633728b48241bd981a982d8fad") }, txinwitness: Some(["3044022061c0e008e31f2566edf116739c24debb0e4a88bb4cd0f7ed752771dd709bfca502204974d2c3eb869d8c0f8813128ff536dc078177c4cf6a6c1412636bb81ccbfd8d01", "02641741221fcf8af641aa1d232153c027da89d10ace5044ea79b6c2574432b392"]), sequence: 4294967295 }
2024-11-05T06:03:00Z Error invalidating block 969578: NotFoundIndex { action: Invalidate, type: "invalidate_script_unspent_vin Transaction", id: "b2547c166179a771e86289c022e97c71d8cd04179477d56e39fb35e430b8b4a7" }
2024-11-05T06:03:00Z ERROR: ConnectBlock: NotFoundIndex { action: Invalidate, type: "invalidate_script_unspent_vin Transaction", id: "b2547c166179a771e86289c022e97c71d8cd04179477d56e39fb35e430b8b4a7" }

@canonbrother canonbrother force-pushed the canonbrother/ocean-fix-invalidate-flow-by-reverse-loop branch from 78f52cd to b12025f Compare November 5, 2024 08:54
Base automatically changed from ocean-catchup-on-startup to master November 5, 2024 09:19
@canonbrother canonbrother marked this pull request as ready for review November 5, 2024 09:29
@canonbrother canonbrother force-pushed the canonbrother/ocean-fix-invalidate-flow-by-reverse-loop branch from d657bf1 to 1ceddfd Compare November 5, 2024 09:30
@canonbrother canonbrother self-assigned this Nov 5, 2024
@canonbrother canonbrother force-pushed the canonbrother/ocean-fix-invalidate-flow-by-reverse-loop branch from 1ceddfd to f17463f Compare November 5, 2024 14:07
@prasannavl prasannavl merged commit 4180a90 into master Nov 11, 2024
18 of 28 checks passed
@prasannavl prasannavl deleted the canonbrother/ocean-fix-invalidate-flow-by-reverse-loop branch November 11, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants