Skip to content

Do not include satisfaction in policy id calculation #123

@afilini

Description

@afilini

Currently every node in the Policy tree has an id which is calculated as a checksum on the string of the json-serialized object:

https://github.com/bitcoindevkit/bdk/blob/d6a0cf0795d9f8a1550e614e96b339a18fc537dc/crates/bdk/src/descriptor/policy.rs#L174-L178

The object includes details about whether the current wallet can satisfy the policy in some ways (aka contribution), and these are also included in the checksum. The same is true for what in a psbt is currently satisfied, which is the satisfaction field of Policy.

This causes the id of the nodes to change from wallet to wallet, depending on which private keys a wallet has or depending on which psbt you are looking at. Ideally if both wallets have the same public descriptor, they should also have the same id for the nodes, which makes sharing policy_paths much easier.

I would recommend changing the way the id is calculated, if you have any ideas let me know. I could also try working on it myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiA breaking API changenew featureNew feature or request

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions