1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

slightly changed block format

- small change in block format
- added config in blockchain explorer
- bugfixes
This commit is contained in:
ton 2019-11-28 18:44:14 +04:00
parent 7f3a22a217
commit 090e0c16eb
82 changed files with 1852 additions and 391 deletions

View file

@ -84,6 +84,9 @@ class HttpAnswer {
struct BlockViewLink {
ton::BlockIdExt block_id;
};
struct ConfigViewLink {
ton::BlockIdExt block_id;
};
struct BlockDownloadLink {
ton::BlockIdExt block_id;
};
@ -116,9 +119,16 @@ class HttpAnswer {
struct CodeBlock {
std::string data;
};
struct ConfigParam {
td::int32 idx;
td::Ref<vm::Cell> root;
};
struct Error {
td::Status error;
};
struct Notification {
std::string text;
};
template <class T>
struct RawData {
td::Ref<vm::Cell> root;
@ -189,14 +199,17 @@ class HttpAnswer {
HttpAnswer &operator<<(TransactionLinkShort trans);
HttpAnswer &operator<<(BlockLink block);
HttpAnswer &operator<<(BlockViewLink block);
HttpAnswer &operator<<(ConfigViewLink block);
HttpAnswer &operator<<(BlockDownloadLink block);
HttpAnswer &operator<<(Error error);
HttpAnswer &operator<<(Notification notification);
HttpAnswer &operator<<(TransactionList trans);
HttpAnswer &operator<<(CodeBlock block) {
return *this << "<pre><code>" << block.data << "</code></pre>";
}
HttpAnswer &operator<<(ConfigParam conf);
template <class T>
HttpAnswer &operator<<(RawData<T> data) {
@ -220,3 +233,16 @@ class HttpAnswer {
std::unique_ptr<td::StringBuilder> sb_;
td::BufferSlice buf_;
};
template <>
struct HttpAnswer::RawData<void> {
td::Ref<vm::Cell> root;
RawData(td::Ref<vm::Cell> root) : root(std::move(root)) {
}
};
template <>
inline HttpAnswer &HttpAnswer::operator<<(RawData<void> data) {
std::ostringstream outp;
vm::load_cell_slice(data.root).print_rec(outp);
return *this << CodeBlock{outp.str()};
}