Page MenuHomePhabricator

[chronik-client] Support for confirmedTxs and unconfirmedTxs in script
ClosedPublic

Authored by bytesofman on Mar 9 2024, 00:33.

Details

Summary

T3441

Neglected to add these when initially did the script endpoints.

Test Plan

CI

Diff Detail

Repository
rABC Bitcoin ABC
Branch
standard-script-endpoints
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27796
Build 55151: Build Diffchronik-client-integration-tests · chronik-client-tests
Build 55150: arc lint + arc unit

Event Timeline

Failed tests logs:

====== Get script().history and script().utxos(): New regtest chain.Get script().history and script().utxos() New regtest chain ======
AssertionError: expected promise to be rejected with an error including 'Failed getting /script/p2pkh/deadbeef…' but got 'Failed getting /script/p2pkh/deadbeef…'

      + expected - actual

      -Failed getting /script/p2pkh/deadbeef/confirmed-txs?page=0&page_size=25 (): 400: Invalid payload for P2PKH: Invalid length, expected 20 bytes but got 4 bytes
      +Failed getting /script/p2pkh/deadbeef/confirmed-txs?page=0&page_size=25 (): 400: Invalid hex: Invalid character 'j' at position 0
====== Get script().history and script().utxos(): After some txs have been broadcast.Get script().history and script().utxos() After some txs have been broadcast ======
AssertionError: expected { txs: [ { …(11) }, …(24) ], …(2) } to deeply equal { txs: [ { …(11) }, …(24) ], …(2) }
    at /work/modules/chronik-client/test/integration/script_endpoints.ts:432:44
    at Generator.next (<anonymous>)
    at fulfilled (test/integration/script_endpoints.ts:31:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

      + expected - actual

         "txs": [
           {
             "inputs": [
               {
      -          "inputScript": "473044022014c54a0be4942bb8626884cccb6878a129e45fe2d71eeaa33048fb4f7a74591502202fa20743a69001e43bf76223ac080edd3b5fc3ff36e3b5c74bb8ae21d5b05b3941210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "47304402203b6f8bcdae1403b165db6bb8642ae987134b904f8adb477c3622ee8ca9a801f102205b48f89a72bf427f7639671a6b1d246a1f2e5aed65820ece2802b554098a8d4d41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "d17ac12d58fd958bb661fdd19293e683fbd0a3291ef996cdec4b1c9e4a9895b2"
      +            "txid": "44dec5e205aee36d8741ca275c5552b4db1509b1468c6b833e9ac20ed3a61eb8"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "isCoinbase": false
             "lockTime": 0
             "outputs": [
               {
      -          "outputScript": "76a914a5af00cdfdadd2958dd4d9910803de129482095088ac"
      -          "value": 4999299775
      +          "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      +          "value": 2400000
               }
               {
      -          "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 700000
      +          "outputScript": "76a914dc684aa911433ada0e5fe737b97753f0daf19b0188ac"
      +          "value": 4997599775
               }
             ]
             "size": 225
      -      "timeFirstSeen": 1709944620
      +      "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "4baf26648563c78033c968242c2cc60f5f7cb75b3eeda7bc6467ff566ee47ae1"
      +      "txid": "e33b23beeadb214fb1172cb56e3efa5e9a89c7832bf09251d509689f1b5eae1c"
             "version": 2
           }
           {
             "inputs": [
               {
      -          "inputScript": "47304402205847d57e9ba92154895ef2cf329a11e62887d84ae3b05130d6cdf4156e3d00b60220397a5a09e626f55ab969e157cbb038b52e38f8e50bfd4c7f4e73bc234537e7a341210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "473044022060fffe5aef44be45270fe2ef642fe9b119d11486395280b2e9470b7a0693d68102207e7f00d4931e2db19d36ba2aa0865fe06eac5ba4d527a71c45062cfaef3e046c41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "e2753f3513044f4d0ed7189648955f7f76747d7e496a550e904097d18171a928"
      +            "txid": "bb24b6b1106ee061251975b0ce17d042ef1e71d1711c716530a817b2cc11ba73"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "isCoinbase": false
             "lockTime": 0
             "outputs": [
               {
      -          "outputScript": "76a9149dc3c32bd2424bb904cc015aba5711d3baceebe088ac"
      -          "value": 4999499775
      +          "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      +          "value": 1000000
               }
               {
      -          "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 500000
      +          "outputScript": "76a91408a7894932e68946474fc27c1db5986846ec170388ac"
      +          "value": 4998999775
               }
             ]
             "size": 225
      -      "timeFirstSeen": 1709944620
      +      "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "6eafce0a6800d8286de6d3e12bca15797aa3385d556f259a06c6835c58abff00"
      +      "txid": "d8e4f72fb32bffd8c7a278329726d1a1b4b62d64fb9a40a54717001b578548db"
             "version": 2
           }
           {
             "inputs": [
               {
      -          "inputScript": "47304402202457588ec12bad76e707333c53b73fd4739c9d0dbc21f6743d02aaf5d285163b02203cd7536aadd1814337bfbb4c75112d619c6e6ca445ae775dce69feb4c46f79d541210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "473044022016b74f77301e9b2deac03b7375dc7dcf02975f9552b6f6247a1ccabf1acaaec9022017265e13e3bc0cda48f71aba734f5c8391eb1d628474da0280b6bc090952a50e41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "4dd9ed3767e6073465f48bca1b36c32a6a07c055f2d964a13a72afe3580bf694"
      +            "txid": "dc32b4baa747eeb9672701a80e06b558e53c411da6e8f65b952ba07971be60cf"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "isCoinbase": false
             "lockTime": 0
             "outputs": [
               {
      -          "outputScript": "76a9146bc56e8392bb9e42ed5759936602c5f7f55df4ca88ac"
      -          "value": 4999399775
      +          "outputScript": "76a914fae26d3a69e721e99f75c553aeda77e66718bea188ac"
      +          "value": 4998499775
               }
               {
                 "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 600000
      +          "value": 1500000
               }
             ]
             "size": 225
      -      "timeFirstSeen": 1709944620
      +      "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "98aa3fae82d4ff10cfe5dcd9b4fa79ce850a55246268e1432a55913c2da85767"
      +      "txid": "d41a3be36a2925efb3929f2aad4ea3933aa016d110084a93bd10a15c9b26452c"
             "version": 2
           }
           {
             "inputs": [
               {
      -          "inputScript": "47304402206069e2c0d89c93d2b4d17a3f6b9d0825b2fc9b29d0fcf53179f4c3da01c1ff5f02206a4a11f723be5b776f86ce41a8b1f257133de0c49d045fdf206168fac271640941210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "473044022038c456a04d990ccff62f3ce81ccd2238374e7687aedd4256471d7e29b722274002201908734a68c4609703a3e6ee0805f0a0db9babde34d5ba9c566d2309934708ca41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "6f81f9b315920ba00f82d662e62c020e023ae2086d86254ddcb7fdc15acd3713"
      +            "txid": "f214f554f68bc7f78e9b9500ba4fbd177e975be038d6e750d4d97955e96a3ffd"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "isCoinbase": false
             "lockTime": 0
             "outputs": [
               {
      -          "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 300000
      +          "outputScript": "76a9148ae0288321f4adaf5a3a25c4ec899a01ef38162e88ac"
      +          "value": 4998199775
               }
               {
      -          "outputScript": "76a914d9f6aa37fb11c8b9cc87acb7e80d8da088701de388ac"
      -          "value": 4999699775
      +          "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      +          "value": 1800000
               }
             ]
             "size": 225
      -      "timeFirstSeen": 1709944620
      +      "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "c1975b69d3825198483315eaf297a7e4bb7bd90b8c710064faf35da6f2a77ce8"
      +      "txid": "d2fa4c7f6812837f4af29dc4a65d113b5599b5cd71d4d8b7222d394288070c19"
             "version": 2
           }
           {
             "inputs": [
               {
      -          "inputScript": "47304402203834b15f57176d3bab6479ccba5d8c6adc9645e34c9c853ca2e3eff8e0b63d0d0220554cac66f5ef7ad4511492e75656a301bb269a83be4db39fb02c41ea8352b8a941210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "47304402201ec4a94bb511495e5ad1790798a8f0dfa1a15081710cef79732fc37294b57cb202205d36fe726e07fc74a1e936a7149bffb661092419950900840b3ec79b67e2fbcf41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "7200a20c1175f94660fd3e65b2aeeb4050faf773bbb4abbb7d628daa824d89fd"
      +            "txid": "c9577d75a5ef788acbd258f65fbadc422b25f982c172575f6bf73469709e4a95"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "isCoinbase": false
             "lockTime": 0
             "outputs": [
               {
      -          "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 400000
      +          "outputScript": "76a914e97767f69b5fb48d1bcd81d624fc693dc8fe04a688ac"
      +          "value": 4998599775
               }
               {
      -          "outputScript": "76a9148c418025bec7a22cb69fec6dcfc199e2c68bed1788ac"
      -          "value": 4999599775
      +          "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      +          "value": 1400000
               }
             ]
             "size": 225
      -      "timeFirstSeen": 1709944620
      +      "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "c78f91bdb1c54c72f8245815dca2f5402fa95f28cc5a46583d56102217a2cee0"
      +      "txid": "d1e4f7c320e9b738348879c2875a58ee72ea9a35c9c5c14d18d697c22022cc44"
             "version": 2
           }
           {
             "inputs": [
               {
      -          "inputScript": "473044022030da89647204a82941a7500753353eb5766011a5d26afe24e61aeea5cd05fd580220199b436133164142884411c6b6adc264b3bab4d35b8bc7f80c2622e36695c7c441210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "4730440220245647ae8d958898d8510789a5b596b6b2f956ea8bedcb6ff0032d1603c97c9c022042e8a12fd8d1252904e0f16ff041206a304034d94327dd8eb54bc967a42ac7c241210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "5dc156fad56ff4abc76afa8f7e0c885ef2b3f9ef74f227f714d63592266443ab"
      +            "txid": "fcbebb16967a1a12287425c0af0de97e5ba3b63dc43a2ed22074c0e2d660cf92"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "isCoinbase": false
             "lockTime": 0
             "outputs": [
               {
      -          "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 100000
      +          "outputScript": "76a914bad4256e67c276d4d910bbe76b5ab3ad9afd26a088ac"
      +          "value": 4998299775
               }
               {
      -          "outputScript": "76a9142fb88abaf4d1422367a5d2813bdf48cde17d453c88ac"
      -          "value": 4999899775
      +          "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      +          "value": 1700000
               }
             ]
             "size": 225
      -      "timeFirstSeen": 1709944620
      +      "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "cfd31f146ffe3d1ff92560f3c0de028355e65f370473f07ba9405fb08df231ef"
      +      "txid": "aac055fce7ac76a614f6892bad3dda92d577c994abb0886f1c36b9ac19344225"
             "version": 2
           }
           {
             "inputs": [
               {
      -          "inputScript": "47304402203ab4c3672355367eb9abb2ac99d43e956a1fb40e523f4b95176e2dc982d5e33002201f711a250295c8220c64507a727b5e174fcabd77c0259471285bd52029d807fa41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "47304402207f6ac96b3bb82e06736e7dd6609e2e6e908bebbce4bf3f79369160d2dfddd1c4022040810374c4eda3c0ae5337698bc3df906a7d6d2d78667fe52dfb2d364e246a6641210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "fff80a2000a77d71bc299335b55430706357dc82595356e3ca5bfe2d81c67ff8"
      +            "txid": "4bc4617489bb5fc0927eb5b3e5fe1cd2825dc88df504d67c1f206fde01a166e9"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "lockTime": 0
             "outputs": [
               {
                 "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 200000
      +          "value": 2100000
               }
               {
      -          "outputScript": "76a914dd375985a219ff0feec32133d5779c38c13ba04188ac"
      -          "value": 4999799775
      +          "outputScript": "76a91419a6e134b1bd2996bf2409d8350e0e465c201ab088ac"
      +          "value": 4997899775
               }
             ]
             "size": 225
      -      "timeFirstSeen": 1709944620
      +      "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "d7f6a28d74dffdc63f444842d840d9ac901879e60fcabab17
      +      "txid": "8749acf22b757f21832d15fb82191c8bc4abc108e6
      
      [mocha] output truncated to 8192 characters, see "maxDiffSize" reporter-option
====== Get script().history and script().utxos(): After these txs are mined.Get script().history and script().utxos() After these txs are mined ======
AssertionError: expected { txs: [ { …(12) }, …(24) ], …(2) } to deeply equal { txs: [ { …(12) }, …(24) ], …(2) }
    at /work/modules/chronik-client/test/integration/script_endpoints.ts:628:42
    at Generator.next (<anonymous>)
    at fulfilled (test/integration/script_endpoints.ts:31:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

      + expected - actual

               "timestamp": 1709944624
             }
             "inputs": [
               {
      -          "inputScript": "473044022057223b00d09ae508f7ecd698d376238da884136850663c2e22459d36460264a60220294ed867b495b05ba98a093214b3056d99e5e04772953eb228e47a83198566bc41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "47304402203b6f8bcdae1403b165db6bb8642ae987134b904f8adb477c3622ee8ca9a801f102205b48f89a72bf427f7639671a6b1d246a1f2e5aed65820ece2802b554098a8d4d41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "f62c419d1d21f07eae7b74b004ada71277104c804e5124139f995aa8fe09c62e"
      +            "txid": "44dec5e205aee36d8741ca275c5552b4db1509b1468c6b833e9ac20ed3a61eb8"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "lockTime": 0
             "outputs": [
               {
                 "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 800000
      +          "value": 2400000
               }
               {
      -          "outputScript": "76a914e826ec213c9e51b707e647e46bfbbe588eae4e7088ac"
      -          "value": 4999199775
      +          "outputScript": "76a914dc684aa911433ada0e5fe737b97753f0daf19b0188ac"
      +          "value": 4997599775
               }
             ]
             "size": 225
             "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "00bdec77c3a6dd6e714b30f497ec4f56e2545ccb89ad80c94f8874a2f2afef71"
      +      "txid": "e33b23beeadb214fb1172cb56e3efa5e9a89c7832bf09251d509689f1b5eae1c"
             "version": 2
           }
           {
             "block": {
--
               "timestamp": 1709944624
             }
             "inputs": [
               {
      -          "inputScript": "473044022007c5ed8b5708959d645095fa31f92db24e2c790ded9733f35d0af03fa111b5df0220470c6eebfec453aa8b480ef9c5227215ff886e87fdf9ecb28b58545030ca9c9741210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "473044022060fffe5aef44be45270fe2ef642fe9b119d11486395280b2e9470b7a0693d68102207e7f00d4931e2db19d36ba2aa0865fe06eac5ba4d527a71c45062cfaef3e046c41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "60a41e34348776990de88c135466554380f18e051dd8d954e181e7a6d48e7819"
      +            "txid": "bb24b6b1106ee061251975b0ce17d042ef1e71d1711c716530a817b2cc11ba73"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "lockTime": 0
             "outputs": [
               {
                 "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 1300000
      +          "value": 1000000
               }
               {
      -          "outputScript": "76a9149e138163bb8a38b036c1582affbf66ddc954b10588ac"
      -          "value": 4998699775
      +          "outputScript": "76a91408a7894932e68946474fc27c1db5986846ec170388ac"
      +          "value": 4998999775
               }
             ]
             "size": 225
             "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "0c48958f90df11759a64ce2079d6897c3bd5f06d0eb4cc9712a139bc20268775"
      +      "txid": "d8e4f72fb32bffd8c7a278329726d1a1b4b62d64fb9a40a54717001b578548db"
             "version": 2
           }
           {
             "block": {
--
               "timestamp": 1709944624
             }
             "inputs": [
               {
      -          "inputScript": "473044022059e3376adbd2949f3e1550c395824d49b6481faa8c5f4e47510bc6ff1559933f022072a4d5eab94fb40d918afe6a4906cc89147b202ff52e78ecbcde48ca17c9301841210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "473044022016b74f77301e9b2deac03b7375dc7dcf02975f9552b6f6247a1ccabf1acaaec9022017265e13e3bc0cda48f71aba734f5c8391eb1d628474da0280b6bc090952a50e41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "a9da0977b127c3cbcff5ca7bc95db3a69445610c795ca86f3719c91f959c01e8"
      +            "txid": "dc32b4baa747eeb9672701a80e06b558e53c411da6e8f65b952ba07971be60cf"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "isCoinbase": false
             "lockTime": 0
             "outputs": [
               {
      -          "outputScript": "76a91498ff2e5c81521dd1b3a0379f4ff752b9befb07d788ac"
      -          "value": 4997699775
      +          "outputScript": "76a914fae26d3a69e721e99f75c553aeda77e66718bea188ac"
      +          "value": 4998499775
               }
               {
                 "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 2300000
      +          "value": 1500000
               }
             ]
             "size": 225
             "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "0dd5a265de1643805bb450ff84353bcc76f3f26cb15ba9b2838e600730fe27b2"
      +      "txid": "d41a3be36a2925efb3929f2aad4ea3933aa016d110084a93bd10a15c9b26452c"
             "version": 2
           }
           {
             "block": {
--
               "timestamp": 1709944624
             }
             "inputs": [
               {
      -          "inputScript": "47304402205df1df2a14a84577ce1445d04245bb0df171fe9f0a603b011891ae98b480fc53022055c4bb455f9968e23816b58a5c81e0d83661daf87074ceb099dd734fe0579c2b41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "473044022038c456a04d990ccff62f3ce81ccd2238374e7687aedd4256471d7e29b722274002201908734a68c4609703a3e6ee0805f0a0db9babde34d5ba9c566d2309934708ca41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "8ce125fb0ba4ac553670ce64f806c2bdd1932b3d26ba73c890d7f3ad366ae3fe"
      +            "txid": "f214f554f68bc7f78e9b9500ba4fbd177e975be038d6e750d4d97955e96a3ffd"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "isCoinbase": false
             "lockTime": 0
             "outputs": [
               {
      -          "outputScript": "76a914c0c65f6e7f028ede85c143aef2ef32a99816f8c688ac"
      -          "spentBy": {
      -            "outIdx": 0
      -            "txid": "d6fce33874db6b36be5fbaae6036a4fa1f1e13bc80b967333e7d7a07942106ac"
      -          }
      -          "value": 4997499775
      +          "outputScript": "76a9148ae0288321f4adaf5a3a25c4ec899a01ef38162e88ac"
      +          "value": 4998199775
               }
               {
                 "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 2500000
      +          "value": 1800000
               }
             ]
             "size": 225
             "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "1122ef34b4ad4d7bacf82c73bab9df9d726797c05e024d2c2a0e929b94daf1d1"
      +      "txid": "d2fa4c7f6812837f4af29dc4a65d113b5599b5cd71d4d8b7222d394288070c19"
             "version": 2
           }
           {
             "block": {
--
               "timestamp": 1709944624
             }
             "inputs": [
               {
      -          "inputScript": "473044022047359485d04ca6b4c6e0c8077a259fcdfea6067e8c33b27442ff4a74c46beb4e02207a2cfde3a50402311cb1e2dafa810723579bd225e864e84ca3b8a1f0dad09e1441210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "47304402201ec4a94bb511495e5ad1790798a8f0dfa1a15081710cef79732fc37294b57cb202205d36fe726e07fc74a1e936a7149bffb661092419950900840b3ec79b67e2fbcf41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "87f6a557154ead62ac06a9482793b1a2fade2ed99bc339015a091cb45bf3c67f"
      +            "txid": "c9577d75a5ef788acbd258f65fbadc422b25f982c172575f6bf73469709e4a95"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "isCoinbase": false
             "lockTime": 0
             "outputs": [
               {
      -          "outputScript": "76a914d0fd151d975e70efce217369a5ecf3ed0ec9a86188ac"
      -          "value": 4997999775
      +          "outputScript": "76a914e97767f69b5fb48d1bcd81d624fc693dc8fe04a688ac"
      +          "value": 4998599775
               }
               {
                 "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 2000000
      +          "value": 1400000
               }
             ]
             "size": 225
             "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "2a1da06ba8d6da6b70c1c1d26fab75354c95dc8ea327c6bc332520dcbe36152d"
      +      "txid": "d1e4f7c320e9b738348879c2875a58ee72ea9a35c9c5c14d18d697c22022cc44"
             "version": 2
           }
           {
             "block": {
--
               "timestamp": 1709944624
             }
             "inputs": [
               {
      -          "inputScript": "47304402204b68c5b21ceff4e1793a4c978c0a30c65181d0c66a3fcf0c6857e242524514d402204a5b36c3ca1e2d8eeb18232b5cf75ce03ba563fbed85f8ce779e405d2f33c76b41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
      +          "inputScript": "4730440220245647ae8d958898d8510789a5b596b6b2f956ea8bedcb6ff0032d1603c97c9c022042e8a12fd8d1252904e0f16ff041206a304034d94327dd8eb54bc967a42ac7c241210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f"
                 "outputScript": "76a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac"
                 "prevOut": {
                   "outIdx": 0
      -            "txid": "5ed872436a14f7111d80bc2b5c2154f9d2c24cc2c29e9b89ad2e72a6e8a24f8e"
      +            "txid": "fcbebb16967a1a12287425c0af0de97e5ba3b63dc43a2ed22074c0e2d660cf92"
                 }
                 "sequenceNo": 4294967294
                 "value": 5000000000
               }
--
             "isCoinbase": false
             "lockTime": 0
             "outputs": [
               {
      -          "outputScript": "76a9144d8b399af9e7f9a61507459722ef6c9a58ad95f588ac"
      -          "value": 4998899775
      +          "outputScript": "76a914bad4256e67c276d4d910bbe76b5ab3ad9afd26a088ac"
      +          "value": 4998299775
               }
               {
                 "outputScript": "76a914d37c4c809fe9840e7bfa77b86bd47163f6fb6c6088ac"
      -          "value": 1100000
      +          "value": 1700000
               }
             ]
             "size": 225
             "timeFirstSeen": 1709944621
             "tokenEntries": []
             "tokenFailedParsings": []
             "tokenStatus": "TOKEN_STATUS_NON_TOKEN"
      -      "txid": "3ae6f0ff870c6263c232b649bee2b1e6666f0b6c68829ca70bd214b2fea4e710"
      +      "txid": "aac055fce7ac76a614f6892bad3dda92d577c994abb0886f1c36b9ac19344225"
             "version": 2
           }
      -    {
      +    {
      +      "block": {
      +        "hash": "4bfd3099fefbfa5a3d5209f9955435d1b912660ddac82d2d11db509c55eff5b4"
      +        "height": 201
      +        "timestamp": 1
      
      [mocha] output truncated to 8192 characters, see "maxDiffSize" reporter-option
====== Get script().history and script().utxos(): After these txs are avalanche finalized.Get script().history and script().utxos() After these txs are avalanche finalized ======
AssertionError: expected 25 to deeply equal +0
    at /work/modules/chronik-client/test/integration/script_endpoints.ts:707:43
    at Generator.next (<anonymous>)
    at fulfilled (test/integration/script_endpoints.ts:31:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

      + expected - actual

      -25
      +0

Each failure log is accessible here:
Get script().history and script().utxos(): New regtest chain.Get script().history and script().utxos() New regtest chain
Get script().history and script().utxos(): After some txs have been broadcast.Get script().history and script().utxos() After some txs have been broadcast
Get script().history and script().utxos(): After these txs are mined.Get script().history and script().utxos() After these txs are mined
Get script().history and script().utxos(): After these txs are avalanche finalized.Get script().history and script().utxos() After these txs are avalanche finalized

integration tests and sorting

tobias_ruck added a subscriber: tobias_ruck.
tobias_ruck added inline comments.
modules/chronik-client/src/ChronikClientNode.ts
227
247
modules/chronik-client/test/integration/script_endpoints.ts
408

confirmed-txs is sorted in block order, unconfirmed-txs in first-seen order

627

this needs to be fixed

634–636

this needs to be fixed too

672

this one is correct!

This revision now requires changes to proceed.Mar 12 2024, 00:00
bytesofman added inline comments.
modules/chronik-client/test/integration/script_endpoints.ts
627

Updated the comment. This is how we are getting these txs though, i.e. if I change below to

historyClone.sort(
                (b, a) =>
                    a.txid.localeCompare(b.txid),
            );

the tests fail

bytesofman marked an inline comment as done.

rebase, update comments

Fabien added a subscriber: Fabien.
Fabien added inline comments.
modules/chronik-client/test/integration/script_endpoints.ts
431 ↗(On Diff #46109)

What is this comment about ? It seems randomly placed

bytesofman marked an inline comment as done.

comment patch

modules/chronik-client/test/integration/script_endpoints.ts
627

nvm I read the test incorrectly, my bad. This is testing the history endpoint, so the sorting you provide is exactly the right sorting according to spec (timeFirstSeen first, otherwise txid).

tobias_ruck added inline comments.
modules/chronik-client/src/ChronikClientNode.ts
294 ↗(On Diff #46121)

This is the wrong place, maybe I messed up my review previously

314 ↗(On Diff #46121)

here it should be

This revision now requires changes to proceed.Mar 13 2024, 19:43
bytesofman marked 3 inline comments as done.

patch comments per feedback

This revision is now accepted and ready to land.Mar 14 2024, 09:00