bitcoindevkit / bitcoindevkit/bdk

Move `TxTemplate` to `bdk_testenv` and make it better

Open
#1,936 11 comments 1 reaction 1 assignee Claimed by @tvpeter View on GitHub
good first issue tests
Dominant language
Rust
Stars
1.1k
Forks
483
Avg merge
20d 3h
Merged PRs (30d)
3

Description

## Context

The `TxTemplate` stuff currently resides in `crates/chain/tests/common/mod.rs`, making it only accessible for `bdk_chain` tests residing in the `tests` dir.

However, building a `TxGraph` from `TxTemplate`s are useful elsewhere (such as for benchmarks as I've discovered while working on bitcoindevkit/bdk#1670 - more on this later).

## Proposal

1. Move `TxTemplate` types and logic to `bdk_testenv`.
2. Use `Cow<'static, B>` for struct fields and `init_graph` inputs. This allows us to be more flexible when creating templates (they can be owned and returned by methods and manipulated later on).
3. Redo the benchmarks introduced by bitcoindevkit/bdk#1670 using `TxTemplate`.
4. Come up with helper methods to make the work in `3.` easier.

## Dependencies

This should be done after bitcoindevkit/bdk#1670 is merged to avoid merge conflicts.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.