| 781 | } |
| 782 | |
| 783 | bool WalletStateBasic::get_transaction(Hash tid, TransactionPrefix *tx, api::Transaction *ptx) const { |
| 784 | // auto trkey = INDEX_TID_to_TRANSACTIONS + DB::to_binary_key(tid.data, sizeof(tid.data)); |
| 785 | // BinaryArray data; |
| 786 | // if (!m_db.get(trkey, data)) |
| 787 | // return false; |
| 788 | // TODO - remove cursor after upgrade of WalletState db |
| 789 | auto cur = m_db.begin(INDEX_TID_to_TRANSACTIONS + DB::to_binary_key(tid.data, sizeof(tid.data))); |
| 790 | if (cur.end()) |
| 791 | return false; |
| 792 | TransactionIndexValue pa; |
| 793 | seria::from_binary(pa, cur.get_value_array(), !cur.get_suffix().empty()); |
| 794 | if (tx) |
| 795 | *tx = std::move(pa.tx); |
| 796 | if (ptx) |
| 797 | *ptx = std::move(pa.atx); |
| 798 | // Experiment with db size reduction |
| 799 | // for (auto &transfer : ptx->transfers) // Restore redundant info |
| 800 | // for(auto & ou : transfer.outputs) |
| 801 | // ou.address = transfer.address; |
| 802 | return true; |
| 803 | } |
| 804 | |
| 805 | void WalletStateBasic::read_unlock_index(std::map<size_t, api::Output> *add, const std::string &index_prefix, |
| 806 | const std::string &address, BlockOrTimestamp begin, BlockOrTimestamp end) const { |
nothing calls this directly
no test coverage detected