Skip to content

Commit e05cd05

Browse files
committed
doc: add another signing flow for multisig with descriptor wallets and PSBTs
1 parent 17dd657 commit e05cd05

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

doc/descriptors.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ The basic steps are:
162162
then the resulting transaction is broadcasted to the network
163163
8. Checks that balances are correct after the transaction has been included in a block
164164

165+
You may prefer a daisy chained signing flow where each participant signs the PSBT one after another until
166+
the PSBT has been signed `M` times and is "complete." For the most part, the steps above remain the same, except (6, 7)
167+
change slightly from signing the original PSBT in parallel to signing it in series. `combinepsbt` is not necessary with
168+
this signing flow and the last (`m`th) signer can just broadcast the PSBT after signing. Note that a parallel signing flow may be
169+
preferable in cases where there are more signers. This signing flow is also included in the test / Python example.
165170
[The test](/test/functional/wallet_multisig_descriptor_psbt.py) is meant to be documentation as much as it is a functional test, so
166171
it is kept as simple and readable as possible.
167172

test/functional/wallet_multisig_descriptor_psbt.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,21 @@ def run_test(self):
139139
assert_approx(self.nodes[0].get_wallet_rpc(f"{self.name}_{0}").getbalance(), deposit_amount - value, vspan=0.001)
140140
assert_equal(self.nodes[self.N - 1].get_wallet_rpc(f"participant_{self.N - 1}").getbalance(), value)
141141

142+
self.log.info("Send another transaction from the multisig, this time with a daisy chained signing flow (one after another in series)!")
143+
psbt = self.make_sending_transaction(to, value)
144+
for m in range(self.M):
145+
signing_wallet = self.nodes[m].get_wallet_rpc(f"participant_{m}")
146+
psbt = signing_wallet.walletprocesspsbt(psbt["psbt"])
147+
assert_equal(psbt["complete"], m == self.M - 1)
148+
finalized = coordinator_wallet.finalizepsbt(psbt["psbt"])
149+
coordinator_wallet.sendrawtransaction(finalized["hex"])
150+
151+
self.log.info("Check that balances are correct after the transaction has been included in a block.")
152+
self.nodes[0].generate(1)
153+
self.sync_all()
154+
assert_approx(self.nodes[0].get_wallet_rpc(f"{self.name}_{0}").getbalance(), deposit_amount - (value * 2), vspan=0.001)
155+
assert_equal(self.nodes[self.N - 1].get_wallet_rpc(f"participant_{self.N - 1}").getbalance(), value * 2)
156+
157+
142158
if __name__ == "__main__":
143159
WalletMultisigDescriptorPSBTTest().main()

0 commit comments

Comments
 (0)