Skip to content

Commit 47d4044

Browse files
committed
Add get_spender().
1 parent 5acc8ed commit 47d4044

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/bitcoin/database/impl/query/objects.ipp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,14 @@ typename CLASS::output::cptr CLASS::get_output(
304304
return out.output;
305305
}
306306

307+
TEMPLATE
308+
typename CLASS::point CLASS::get_spender(const point_link& link) const NOEXCEPT
309+
{
310+
const auto tx = to_spending_tx(link);
311+
const auto index = to_input_index(tx, link);
312+
return { get_tx_key(tx), index };
313+
}
314+
307315
TEMPLATE
308316
typename CLASS::inputs_ptr CLASS::get_spenders(
309317
const output_link& link, bool witness) const NOEXCEPT

include/bitcoin/database/query.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ class query
397397
script::cptr get_output_script(const output_link& link) const NOEXCEPT;
398398
output::cptr get_output(const output_link& link) const NOEXCEPT;
399399
output::cptr get_output(const tx_link& link, uint32_t index) const NOEXCEPT;
400+
point get_spender(const point_link& link) const NOEXCEPT;
400401
inputs_ptr get_spenders(const output_link& link,
401402
bool witness) const NOEXCEPT;
402403

0 commit comments

Comments
 (0)