File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1245,6 +1245,29 @@ impl RpcMethod<1> for ChainTipSetWeight {
12451245 }
12461246}
12471247
1248+ pub enum ChainGetTipsetByParentState { }
1249+ impl RpcMethod < 1 > for ChainGetTipsetByParentState {
1250+ const NAME : & ' static str = "Forest.ChainGetTipsetByParentState" ;
1251+ const PARAM_NAMES : [ & ' static str ; 1 ] = [ "parentState" ] ;
1252+ const API_PATHS : BitFlags < ApiPaths > = ApiPaths :: all ( ) ;
1253+ const PERMISSION : Permission = Permission :: Read ;
1254+
1255+ type Params = ( Cid , ) ;
1256+ type Ok = Option < Tipset > ;
1257+
1258+ async fn handle (
1259+ ctx : Ctx < impl Blockstore > ,
1260+ ( parent_state, ) : Self :: Params ,
1261+ ) -> Result < Self :: Ok , ServerError > {
1262+ Ok ( ctx
1263+ . chain_store ( )
1264+ . heaviest_tipset ( )
1265+ . chain ( ctx. store ( ) )
1266+ . find ( |ts| ts. parent_state ( ) == & parent_state)
1267+ . clone ( ) )
1268+ }
1269+ }
1270+
12481271pub const CHAIN_NOTIFY : & str = "Filecoin.ChainNotify" ;
12491272pub ( crate ) fn chain_notify < DB : Blockstore > (
12501273 _params : Params < ' _ > ,
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ macro_rules! for_each_rpc_method {
8888 $callback!( $crate:: rpc:: chain:: ForestChainExportDiff ) ;
8989 $callback!( $crate:: rpc:: chain:: ForestChainExportStatus ) ;
9090 $callback!( $crate:: rpc:: chain:: ForestChainExportCancel ) ;
91+ $callback!( $crate:: rpc:: chain:: ChainGetTipsetByParentState ) ;
9192
9293 // common vertical
9394 $callback!( $crate:: rpc:: common:: Session ) ;
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ Forest.ChainExportCancel
8181Forest.ChainExportDiff
8282Forest.ChainExportStatus
8383Forest.ChainGetMinBaseFee
84+ Forest.ChainGetTipsetByParentState
8485Forest.NetInfo
8586Forest.SnapshotGC
8687Forest.StateActorInfo
You can’t perform that action at this time.
0 commit comments