Page MenuHomePhabricator

[chronik-client] Support raw-tx endpoint in ChronikClientNode
ClosedPublic

Authored by bytesofman on Jan 31 2024, 20:30.

Details

Summary

Add support for the raw-tx endpoint.

I overlooked that this endpoint existed in my first pass of getting this to work. This should have been included with blocktxs and txs, imo closely related.

Use the same test script.

Test Plan

See test plan from D14915 or let CI handle it.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bytesofman added inline comments.
modules/chronik-client/test/integration/blocktxs_and_tx_and_rawtx.ts
144 ↗(On Diff #44810)

we could hash the rawtx and show that it matches the txid. seems a bit overkill though, we aren't testing whether or not chronik works.

If we get the response from a txid input and the response is a string, shows that chronik-client conversion function is working.

Fabien requested changes to this revision.Feb 1 2024, 08:45
Fabien added a subscriber: Fabien.
Fabien added inline comments.
modules/chronik-client/test/integration/blocktxs_and_tx_and_rawtx.ts
142 ↗(On Diff #44810)

It doesn't work on coinbase txs?

144 ↗(On Diff #44810)

You can also get the serialized tx from an IPC message, that was a clever idea for the txids.
Another option is to get the genesis coinbase tx which is a constant for each net (so you can just hardcode it)

This revision now requires changes to proceed.Feb 1 2024, 08:45

pass raw txs from node rpc

modules/chronik-client/test/integration/blocktxs_and_tx_and_rawtx.ts
144 ↗(On Diff #44810)

pushed up one approach (unfinished and failing) -- is this failure expected? Am I doing something weird to the tx by getting its rawtx in the node with rawtx = self.nodes[0].getrawtransaction(txid)?

it causes chronik-client to get this rawtx for the corresponding txid:

00000000ac88f843662780a01bd57dd98b924c69122d9166e45314a97619000000012410101fac88eb6cb3c7c577186da673bfc783af429ef4b4624814a976190000000005f5e10002fffffffe3f5def39c82ffbe9d0b262a47087b304e6758b186adf515bf26c2711a05bd82702214126e4a161572ec95aa93faf8c3f28bc84ae360f07e9139ae64c8b1a9661d7dc4d20020e65e1b085ea6b3e78da400ae00a89f81386f27dc796f042875439ae4799aa4e20024430476a00000000fff80a2000a77d71bc299335b55430706357dc82595356e3ca5bfe2d81c67ff80100000002

which electrum is unable to parse as a rawtx

I'm not sure what's going on with this error -- checking if this could be a chronik issue or if this type of thing is expected based on using the rpc approach

Failed tests logs:

====== Get blocktxs and tx: After some txs have been broadcast.Get blocktxs and tx After some txs have been broadcast ======
AssertionError: expected '00000000ac8835de69958c5fd347efa636508…' to deeply equal '0200000001e63925954f74e2b25cfc6e1080d…'
    at /work/modules/chronik-client/test/integration/blocktxs_and_tx_and_rawtx.ts:169:36
    at Generator.next (<anonymous>)
    at fulfilled (test/integration/blocktxs_and_tx_and_rawtx.ts:28:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

      + expected - actual

      -00000000ac8835de69958c5fd347efa63650827c50193463ef5714a976190000000005f5e100ac8829b78dd2920ce4995598c933b05a002cfd6eb40714a97619000000012410101f02fffffffe3f5def39c82ffbe9d0b262a47087b304e6758b186adf515bf26c2711a05bd827022141ade8cdf046be384f5a6f6557fb32b59334c5306962db83845091bbe168c4f8532002bbd89c897f466f4d2c4d9b50ecbc7146d485aae21d1ebf8845839d4ca978734320024430476a00000000d9b22ff656fda05894ed80e4d689f6396a4dd480106efc5cb2e2744f952539e60100000002
      +0200000001e63925954f74e2b25cfc6e1080d44d6a39f689d6e480ed9458a0fd56f62fb2d9000000006a4730440220437378a94c9d834588bf1e1de2aa85d44671bcec509b4d2c4d6f467f899cd8bb022053f8c468e1bb91508483db626930c53493b532fb57656f5a4f38be46f0cde8ad41210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3ffeffffff021f101024010000001976a91407b46efd2c005ab033c9985599e40c92d28db72988ac00e1f505000000001976a91457ef633419507c825036a6ef47d35f8c9569de3588ac00000000

Each failure log is accessible here:
Get blocktxs and tx: After some txs have been broadcast.Get blocktxs and tx After some txs have been broadcast

bytesofman marked 2 inline comments as done.

fix little-endian mix-up, test for actual rawtxs

This revision is now accepted and ready to land.Feb 1 2024, 19:49