electrs
electrs copied to clipboard
[Opt.] Lightmode - Internal get block TXs now supports genesis + faster full block queries
This PR hits 2 birds with one stone.
In relation to https://github.com/mempool/electrs/pull/119#issuecomment-2803481684
- 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)
- 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 https://github.com/mempool/electrs/pull/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}}]