Skip to content

Move TxTemplate to bdk_testenv and make it better #1936

Open
@evanlinjin

Description

@evanlinjin

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 TxTemplates are useful elsewhere (such as for benchmarks as I've discovered while working on #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 Introduce O(n) canonicalization algorithm #1670 using TxTemplate.
  4. Come up with helper methods to make the work in 3. easier.

Dependencies

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

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions