| 58 | } |
| 59 | |
| 60 | ranges::any_view<Transaction> Address::getInputTransactions() const { |
| 61 | auto _access = access; |
| 62 | Address searchAddress = *this; |
| 63 | return getOutputPointers() |
| 64 | | ranges::views::transform([_access, searchAddress](auto pointer) -> ranges::optional<Transaction> { |
| 65 | auto spendingTx = Output(std::forward<decltype(pointer)>(pointer), *_access).getSpendingTx(); |
| 66 | if (spendingTx) { |
| 67 | RANGES_FOR(auto input, spendingTx->inputs()) { |
| 68 | if (input.getAddress() == searchAddress) { |
| 69 | if (input.getSpentOutputPointer() == pointer) { |
| 70 | return input.transaction(); |
| 71 | } else { |
| 72 | return ranges::nullopt; |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | assert(false); |
| 77 | } else { |
| 78 | return ranges::nullopt; |
| 79 | } |
| 80 | }) |
| 81 | | flatMapOptionals(); |
| 82 | } |
| 83 | |
| 84 | class AddressAllTxRange : public ranges::view_facade<AddressAllTxRange> { |
| 85 | friend ranges::range_access; |
no test coverage detected