MCPcopy Create free account
hub / github.com/citp/BlockSci / getInputTransactions

Method getInputTransactions

src/address/address.cpp:60–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers 5

operator()Method · 0.45
operator()Method · 0.45
init_equiv_addressFunction · 0.45
init_clusterFunction · 0.45
operator()Method · 0.45

Calls 3

getOutputPointersFunction · 0.85
getSpendingTxMethod · 0.80
OutputFunction · 0.50

Tested by

no test coverage detected