This commit is contained in:
Peter Zhang 2025-11-21 16:29:51 +08:00
parent 1bbe6127db
commit 3ceda31452
4 changed files with 25 additions and 2 deletions

View File

@ -87,4 +87,7 @@ pub trait Rpc {
#[method(name = "getFlowContext")]
async fn get_flow_context(&self) -> RpcResult<(H256, u64)>;
#[method(name = "getChunkByIndex")]
async fn get_chunk_by_index(&self, chunk_index: u64) -> RpcResult<Option<Vec<u8>>>;
}

View File

@ -238,6 +238,25 @@ impl RpcServer for RpcServerImpl {
async fn get_flow_context(&self) -> RpcResult<(H256, u64)> {
Ok(self.ctx.log_store.get_context().await?)
}
async fn get_chunk_by_index(&self, chunk_index: u64) -> RpcResult<Option<Vec<u8>>> {
debug!(%chunk_index, "zgs_getChunkByIndex");
match self
.ctx
.log_store
.get_chunk_by_flow_index(chunk_index, 1)
.await?
{
Some(chunk_array) => {
if chunk_array.data.len() > 0 {
Ok(Some(chunk_array.data))
} else {
Ok(None)
}
}
None => Ok(None),
}
}
}
impl RpcServerImpl {

View File

@ -236,7 +236,7 @@ impl FlowWrite for FlowStore {
debug!(
"Entry batch data at 12288 before insert: {:?}",
batch_data_12288.as_ssz_bytes()
batch_data_12288
);
let mut batch_list = Vec::new();
@ -293,7 +293,7 @@ impl FlowWrite for FlowStore {
debug!(
"Entry batch data at 12288 after insert: {:?}",
batch_data_12288.as_ssz_bytes()
batch_data_12288
);
res

View File

@ -1125,6 +1125,7 @@ impl LogManager {
let chunk_roots = self.flow_store.append_entries(flow_entry_array)?;
debug!("fill leaf for pora_chunks_merkle");
for (chunk_index, chunk_root) in chunk_roots {
debug!("fill leaf: chunk_index={}, chunk_root={:?}", chunk_index, chunk_root);
if chunk_index < merkle.pora_chunks_merkle.leaves() as u64 {
merkle
.pora_chunks_merkle