github.com/igggame/nebulas-go@v2.1.0+incompatible/nbre/fs/blockchain/blockchain_api_test.h (about) 1 // Copyright (C) 2018 go-nebulas authors 2 // 3 // This file is part of the go-nebulas library. 4 // 5 // the go-nebulas library is free software: you can redistribute it and/or 6 // modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation, either version 3 of the License, or 9 // (at your option) any later version. 10 // 11 // the go-nebulas library is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with the go-nebulas library. If not, see 18 // <http://www.gnu.org/licenses/>. 19 // 20 #pragma once 21 #include "fs/blockchain/blockchain_api.h" 22 #include "util/lru_cache.h" 23 24 namespace neb { 25 namespace fs { 26 27 class blockchain_api_test : public blockchain_api_base { 28 public: 29 virtual ~blockchain_api_test(); 30 virtual std::unique_ptr<std::vector<transaction_info_t>> 31 get_block_transactions_api(block_height_t height); 32 33 virtual std::unique_ptr<corepb::Account> 34 get_account_api(const address_t &addr, block_height_t height); 35 36 virtual std::unique_ptr<corepb::Transaction> 37 get_transaction_api(const std::string &tx_hash, block_height_t height); 38 39 protected: 40 std::shared_ptr<corepb::Block> get_block_with_height(block_height_t height); 41 42 protected: 43 util::lru_cache<block_height_t, std::shared_ptr<corepb::Block>> m_block_cache; 44 }; 45 } // namespace fs 46 } // namespace neb