@@ -273,16 +273,12 @@ api::SealedTransaction APIHandler::convertTransaction(const csdb::Transaction& t
273273 csdb::Currency currency = transaction.currency ();
274274 csdb::Address address = transaction.source ();
275275 if (address.is_wallet_id ()) {
276- BlockChain::WalletData data_to_fetch_pulic_key;
277- s_blockchain.findWalletData (transaction.source ().wallet_id (), data_to_fetch_pulic_key);
278- address = csdb::Address::from_public_key (data_to_fetch_pulic_key.address_ );
276+ address = s_blockchain.getAddressByType (transaction.source (), BlockChain::AddressType::PublicKey);
279277 }
280278
281279 csdb::Address target = transaction.target ();
282280 if (target.is_wallet_id ()) {
283- BlockChain::WalletData data_to_fetch_pulic_key;
284- s_blockchain.findWalletData (transaction.target ().wallet_id (), data_to_fetch_pulic_key);
285- target = csdb::Address::from_public_key (data_to_fetch_pulic_key.address_ );
281+ target = s_blockchain.getAddressByType (transaction.target (), BlockChain::AddressType::PublicKey);
286282 }
287283
288284 result.id = convert_transaction_id (transaction.id ());
@@ -1978,9 +1974,9 @@ void APIHandler::TokensListGet(api::TokensListResult& _return, int64_t offset, i
19781974}
19791975
19801976// ////////Wallets
1981- typedef std::list<std::pair<const cs::WalletsCache::WalletData::Address *, const cs::WalletsCache::WalletData*>> WCSortedList;
1977+ typedef std::list<std::pair<const cs::PublicKey *, const cs::WalletsCache::WalletData*>> WCSortedList;
19821978template <typename T>
1983- void walletStep (const cs::WalletsCache::WalletData::Address * addr, const cs::WalletsCache::WalletData* wd, const uint64_t num,
1979+ void walletStep (const cs::PublicKey * addr, const cs::WalletsCache::WalletData* wd, const uint64_t num,
19841980 std::function<const T&(const cs::WalletsCache::WalletData&)> getter, std::function<bool(const T&, const T&)> comparator, WCSortedList& lst) {
19851981 assert (num > 0 );
19861982
@@ -2005,7 +2001,7 @@ void iterateOverWallets(std::function<const T&(const cs::WalletsCache::WalletDat
20052001 using Comparer = std::function<bool (const T&, const T&)>;
20062002 Comparer comparator = desc ? Comparer (std::greater<T>()) : Comparer (std::less<T>());
20072003
2008- bc.iterateOverWallets ([&lst, num, getter, comparator](const cs::WalletsCache::WalletData::Address & addr, const cs::WalletsCache::WalletData& wd) {
2004+ bc.iterateOverWallets ([&lst, num, getter, comparator](const cs::PublicKey & addr, const cs::WalletsCache::WalletData& wd) {
20092005 if (!addr.empty () && wd.balance_ >= csdb::Amount (0 )) {
20102006 walletStep (&addr, &wd, num, getter, comparator, lst);
20112007 }
@@ -2069,7 +2065,7 @@ void APIHandler::TrustedGet(TrustedGetResult& _return, int32_t _page) {
20692065 uint32_t limit = PER_PAGE;
20702066 uint32_t total = 0 ;
20712067
2072- s_blockchain.iterateOverWriters ([&_return, &offset, &limit, &total](const cs::WalletsCache::WalletData::Address & addr, const cs::WalletsCache::TrustedData& wd) {
2068+ s_blockchain.iterateOverWriters ([&_return, &offset, &limit, &total](const cs::PublicKey & addr, const cs::WalletsCache::TrustedData& wd) {
20732069 if (addr.empty ()) {
20742070 return true ;
20752071 }
0 commit comments