MCPcopy Create free account
hub / github.com/bcndev/bytecoin / get_transaction

Method get_transaction

src/Core/WalletStateBasic.cpp:783–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

781}
782
783bool 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
805void 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 {

Callers

nothing calls this directly

Calls 5

from_binaryFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
get_value_arrayMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected