Skip to content

Conversation

@portlandhodl
Copy link

@portlandhodl portlandhodl commented Apr 18, 2025

This PR hits 2 birds with one stone.

In relation to #119 (comment)

  1. First is the genesis blocks TXN(s) are now queried right from the block hex and use no maigc. Also not network dependent. (works on any net now and future)
  2. Because the block hex is a single heavy call the overhead of calling getrawtransaction up to thousands of times per block on a request for block data is removed.

Bonus, now the block hash error is separated from the txns fetch error leading to a better debugging experience.

PortlandHODL

This PR competes with #119 as a solution to the genesis block lightmode issue.

Result curl 127.0.0.1:3000/internal/block/0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206/txs

[{"txid":"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b","version":1,"locktime":0,"vin":[{"txid":"0000000000000000000000000000000000000000000000000000000000000000","vout":4294967295,"prevout":null,"scriptsig":"04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73","scriptsig_asm":"OP_PUSHBYTES_4 ffff001d OP_PUSHBYTES_1 04 OP_PUSHBYTES_69 5468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73","is_coinbase":true,"sequence":4294967295}],"vout":[{"scriptpubkey":"4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac","scriptpubkey_asm":"OP_PUSHBYTES_65 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG","scriptpubkey_type":"p2pk","value":5000000000}],"size":204,"weight":816,"sigops":4,"fee":0,"status":{"confirmed":true,"block_height":0,"block_hash":"0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206","block_time":1296688602}}]

@portlandhodl portlandhodl requested review from junderw and mononaut and removed request for mononaut April 18, 2025 09:29
@portlandhodl portlandhodl force-pushed the decode-blocks-v0-lightmode branch 5 times, most recently from db570a8 to 1095a21 Compare April 18, 2025 11:24
[Enh.] Deser. Block Hex Data

[Fix.] Iter support

[Fmt.] Cargo format.

Linter Fix

[Clairty] removed unneeded comment

txids -> txid_vec
@portlandhodl portlandhodl force-pushed the decode-blocks-v0-lightmode branch from 1095a21 to 0939e11 Compare April 18, 2025 11:25
@portlandhodl
Copy link
Author

Closing: Unplanned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant