Skip to content

Commit 090879e

Browse files
authored
Automatically add build_and_sign signers to required_signers (#202)
1 parent ccaafe3 commit 090879e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pycardano/txbuilder.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1237,12 +1237,17 @@ def build_and_sign(
12371237
to the current slot number + the given offset (default 10_000).
12381238
A manually set ttl will always take precedence.
12391239
auto_required_signers (Optional[bool]): Automatically add all pubkeyhashes of transaction inputs
1240-
to required signatories (default only for Smart Contract transactions).
1240+
and the given signers to required signatories (default only for Smart Contract transactions).
12411241
Manually set required signers will always take precedence.
12421242
12431243
Returns:
12441244
Transaction: A signed transaction.
12451245
"""
1246+
# The given signers should be required signers if they weren't added yet
1247+
if auto_required_signers and self.scripts and not self.required_signers:
1248+
self.required_signers = [
1249+
s.to_verification_key().hash() for s in signing_keys
1250+
]
12461251

12471252
tx_body = self.build(
12481253
change_address=change_address,

0 commit comments

Comments
 (0)