[wallet] Take both spending policies into account in create_tx

This allows specifying different "policy paths" for the internal and external
descriptors, and adds additional checks to make sure they are compatibile (i.e.
the timelocks are expressed in the same unit).

It's still suboptimal, since the `n_sequence`s are per-input and not per-transaction,
so it should be possibile to spend different inputs with different, otherwise
incompatible, `CSV` timelocks, but that requires a larger refactor that
can be done in a future patch.

This commit also tries to clarify how the "policy path" should be used by adding
a fairly detailed example to the docs.
This commit is contained in:
Alekos Filini committed 2020-11-13 12:55:42 +01:00
1 parent 9f31ad1bc8
commit 7c80aec454
4 files changed
+181 -16

No files matched your search

+1 -1
View File
@@ -433,7 +433,7 @@ impl Condition {
}
}
fn merge(mut self, other: &Condition) -> Result<Self, PolicyError> {
pub(crate) fn merge(mut self, other: &Condition) -> Result<Self, PolicyError> {
match (self.csv, other.csv) {
(Some(a), Some(b)) => self.csv = Some(Self::merge_timelock(a, b)?),
(None, any) => self.csv = any,