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.
Currently every node in the
Policytree 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 thesatisfactionfield ofPolicy.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.