Skip to content

Commit

Permalink
LS patch
Browse files Browse the repository at this point in the history
  • Loading branch information
SpyCheese committed Sep 5, 2023
1 parent e2cd0ee commit 9256b13
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tl/generate/scheme/lite_api.tl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ liteServer.currentTime now:int = liteServer.CurrentTime;
liteServer.version mode:# version:int capabilities:long now:int = liteServer.Version;
liteServer.blockData id:tonNode.blockIdExt data:bytes = liteServer.BlockData;
liteServer.blockState id:tonNode.blockIdExt root_hash:int256 file_hash:int256 data:bytes = liteServer.BlockState;
liteServer.blockHeader id:tonNode.blockIdExt mode:# header_proof:bytes = liteServer.BlockHeader;
liteServer.blockHeader id:tonNode.blockIdExt mode:# header_proof:bytes tx_cnt:mode.30?int = liteServer.BlockHeader;
liteServer.sendMsgStatus status:int = liteServer.SendMsgStatus;
liteServer.accountState id:tonNode.blockIdExt shardblk:tonNode.blockIdExt shard_proof:bytes proof:bytes state:bytes = liteServer.AccountState;
liteServer.runMethodResult mode:# id:tonNode.blockIdExt shardblk:tonNode.blockIdExt shard_proof:mode.0?bytes proof:mode.0?bytes state_proof:mode.1?bytes init_c7:mode.3?bytes lib_extras:mode.4?bytes exit_code:int result:mode.2?bytes = liteServer.RunMethodResult;
Expand Down
Binary file modified tl/generate/scheme/lite_api.tlo
Binary file not shown.
27 changes: 25 additions & 2 deletions validator/impl/liteserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,32 @@ void LiteQuery::continue_getBlockHeader(BlockIdExt blkid, int mode, Ref<ton::val
fatal_error(proof_data.move_as_error());
return;
}
int tx_cnt = 0;
if (mode & (1 << 30)) {
block::gen::Block::Record blk;
block::gen::BlockInfo::Record info;
CHECK(tlb::unpack_cell(block_root, blk) && tlb::unpack_cell(blk.info, info));
block::gen::BlockExtra::Record extra;
CHECK(tlb::unpack_cell(std::move(blk.extra), extra));
vm::AugmentedDictionary acc_dict{vm::load_cell_slice_ref(extra.account_blocks), 256,
block::tlb::aug_ShardAccountBlocks};
acc_dict.check_for_each([&](td::Ref<vm::CellSlice> value, td::ConstBitPtr key, int n) -> bool {
block::gen::CurrencyCollection::Record skip;
block::gen::csr_unpack_skip(value, skip);
block::gen::AccountBlock::Record acc_blk;
CHECK(tlb::csr_unpack(std::move(value), acc_blk));
vm::AugmentedDictionary trans_dict{vm::DictNonEmpty(), std::move(acc_blk.transactions), 64,
block::tlb::aug_AccountTransactions};
trans_dict.check_for_each([&](td::Ref<vm::CellSlice> value, td::ConstBitPtr key, int n) -> bool {
++tx_cnt;
return true;
});
return true;
});
}
// send answer
auto b = ton::create_serialize_tl_object<ton::lite_api::liteServer_blockHeader>(ton::create_tl_lite_block_id(blkid),
mode, proof_data.move_as_ok());
auto b = ton::create_serialize_tl_object<ton::lite_api::liteServer_blockHeader>(
ton::create_tl_lite_block_id(blkid), mode, proof_data.move_as_ok(), tx_cnt);
finish_query(std::move(b));
}

Expand Down

0 comments on commit 9256b13

Please sign in to comment.