Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Add Blocktree api to get transactions by slot #6966

Merged

Conversation

CriesofCarrots
Copy link
Contributor

@CriesofCarrots CriesofCarrots commented Nov 14, 2019

Problem

Our main downstream use case only needs to introspect confirmed blocks, with an empty result from unconfirmed ones. Currently, blocktree offers no api to return transactions in a slot.

Summary of Changes

  • Adds blocktree api get_confirmed_block_transactions. Method checks whether block is confirmed (slot is_root()) first; if so, it flattens the slot entries vec into a vec of transactions to return.
    It may make more sense to return an Iterator from this method in order to map each Transaction to its Result, once that data is available in blocktree. Will reassess when those apis are implemented.
  • Updates getConfirmedBlock rpc to use now blocktree api. If get_confirmed_block_transactions returns an error, rpc method returns an empty result. JsonRpcRequestProcessor::get_confirmed_block() generates mock transactions statuses, since persistent status cache is not yet implemented (CC: feat: rocksdb (persistent) transaction status cache #6958 )

Toward #6867
FYI: @sunnygleason

Copy link
Contributor

@mvines mvines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@codecov
Copy link

codecov bot commented Nov 14, 2019

Codecov Report

Merging #6966 into master will increase coverage by 13.4%.
The diff coverage is 71.4%.

@@            Coverage Diff            @@
##           master   #6966      +/-   ##
=========================================
+ Coverage    65.5%   78.9%   +13.4%     
=========================================
  Files         221     221              
  Lines       51355   42673    -8682     
=========================================
+ Hits        33666   33698      +32     
+ Misses      17689    8975    -8714

@CriesofCarrots CriesofCarrots merged commit 852a214 into solana-labs:master Nov 14, 2019
@CriesofCarrots CriesofCarrots deleted the blocktree-slot-txs-api branch January 15, 2020 01:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants