mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Merge 5bf65ec66e into merged_master (Bitcoin PR bitcoin/bitcoin#22558)
This commit is contained in:
commit
2d07ef8fc1
17 changed files with 710 additions and 31 deletions
|
|
@ -519,6 +519,7 @@ WitnessV1Taproot TaprootBuilder::GetOutput() { return WitnessV1Taproot{m_output_
|
|||
TaprootSpendData TaprootBuilder::GetSpendData() const
|
||||
{
|
||||
assert(IsComplete());
|
||||
assert(m_output_key.IsFullyValid());
|
||||
TaprootSpendData spd;
|
||||
spd.merkle_root = m_branch.size() == 0 ? uint256() : m_branch[0]->hash;
|
||||
spd.internal_key = m_internal_key;
|
||||
|
|
@ -676,3 +677,19 @@ std::optional<std::vector<std::tuple<int, CScript, int>>> InferTaprootTree(const
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<std::tuple<uint8_t, uint8_t, CScript>> TaprootBuilder::GetTreeTuples() const
|
||||
{
|
||||
assert(IsComplete());
|
||||
std::vector<std::tuple<uint8_t, uint8_t, CScript>> tuples;
|
||||
if (m_branch.size()) {
|
||||
const auto& leaves = m_branch[0]->leaves;
|
||||
for (const auto& leaf : leaves) {
|
||||
assert(leaf.merkle_branch.size() <= TAPROOT_CONTROL_MAX_NODE_COUNT);
|
||||
uint8_t depth = (uint8_t)leaf.merkle_branch.size();
|
||||
uint8_t leaf_ver = (uint8_t)leaf.leaf_version;
|
||||
tuples.push_back(std::make_tuple(depth, leaf_ver, leaf.script));
|
||||
}
|
||||
}
|
||||
return tuples;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue