@@ -12,12 +12,6 @@ has param 'p2sh' => (
1212 writer => 1,
1313);
1414
15- has param ' signature_pushes_only' => (
16- coerce => Bool,
17- default => 1,
18- writer => 1,
19- );
20-
2115# BIP65
2216has param ' checklocktimeverify' => (
2317 coerce => Bool,
@@ -47,7 +41,7 @@ has param 'segwit' => (
4741);
4842
4943# BIP147
50- has param ' nulldummy ' => (
44+ has param ' null_dummy ' => (
5145 coerce => Bool,
5246 default => 1,
5347 writer => 1,
@@ -62,8 +56,14 @@ has param 'taproot' => (
6256
6357# optional standardness rules below
6458
59+ has param ' signature_pushes_only' => (
60+ coerce => Bool,
61+ default => 0,
62+ writer => 1,
63+ );
64+
6565# segwit only
66- has param ' minimalif ' => (
66+ has param ' minimal_if ' => (
6767 coerce => Bool,
6868 default => 0,
6969 writer => 1,
@@ -88,19 +88,19 @@ has param 'low_s_signatures' => (
8888 writer => 1,
8989);
9090
91- has param ' minimaldata ' => (
91+ has param ' minimal_data ' => (
9292 coerce => Bool,
9393 default => 0,
9494 writer => 1,
9595);
9696
97- has param ' nullfail ' => (
97+ has param ' null_fail ' => (
9898 coerce => Bool,
9999 default => 0,
100100 writer => 1,
101101);
102102
103- has param ' cleanstack ' => (
103+ has param ' clean_stack ' => (
104104 coerce => Bool,
105105 default => 0,
106106 writer => 1,
@@ -130,12 +130,11 @@ sub new_empty
130130
131131 return $self -> new(
132132 p2sh => !!0,
133- signature_pushes_only => !!0,
134133 checklocktimeverify => !!0,
135134 der_signatures => !!0,
136135 checksequenceverify => !!0,
137136 segwit => !!0,
138- nulldummy => !!0,
137+ null_dummy => !!0,
139138 taproot => !!0,
140139 %args ,
141140 );
@@ -146,13 +145,14 @@ sub new_full
146145 my ($self , %args ) = @_ ;
147146
148147 return $self -> new(
149- minimalif => !!1,
148+ signature_pushes_only => !!1,
149+ minimal_if => !!1,
150150 compressed_pubkeys => !!1,
151151 strict_encoding => !!1,
152152 low_s_signatures => !!1,
153- minimaldata => !!1,
154- nullfail => !!1,
155- cleanstack => !!1,
153+ minimal_data => !!1,
154+ null_fail => !!1,
155+ clean_stack => !!1,
156156 const_script => !!1,
157157 known_witness => !!1,
158158 illegal_upgradeable_nops => !!1,
@@ -185,7 +185,7 @@ Bitcoin::Crypto::Transaction::Flags - Consensus flags
185185
186186 # disable some flags (those not passed are active)
187187 my $some_flags = Bitcoin::Crypto::Transaction::Flags->new(
188- strict_signatures => !!0,
188+ der_signatures => !!0,
189189 );
190190
191191 # use flags in transaction verification
@@ -197,85 +197,118 @@ This is a class that represents a set of consensus rules used in transaction
197197verification and associated systems. Each attribute of this class represents a
198198single rule.
199199
200- By default, all implemented consensus rules are active. As Bitcoin
201- and this module progress, more rules may be added all enabled by default on
202- arrival. Since Bitcoin is extended through softforks (implemented in a
200+ By default, all implemented consensus rules are active, and all implemented
201+ standardness rules are inactive when calling L</new> . As Bitcoin and this
202+ module progress, more rules may be added all enabled by default on arrival.
203+ Since Bitcoin is extended through softforks (implemented in a
203204backward-compatible manner), this should rarely pose a problem with
204205Bitcoin::Crypto code. If you want to be extra sure, see L</new_empty> .
205206
206207=head1 INTERFACE
207208
208- =head2 Attributes
209+ All the following flags are attributes available in the constructor of the
210+ object. They have writer methods named C<set_X > .
209211
210- =head3 p2sh
212+ =head2 Consensus flags
213+
214+ All consensus flags are active by default.
211215
212- I< Available in the constructor > .
216+ =head3 p2sh
213217
214218Whether P2SH verification defined in
215219L<BIP16|https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki> should
216220be used.
217221
218- I<writer: > C<set_p2sh >
219-
220- =head3 strict_signatures
221-
222- I<Available in the constructor > .
222+ =head3 der_signatures
223223
224224Whether strict DER signature verification defined in
225225L<BIP66|https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki> should
226226be used.
227227
228- I<writer: > C<set_strict_signatures >
229-
230228=head3 checklocktimeverify
231229
232- I<Available in the constructor > .
233-
234230Whether C<OP_CHECKLOCKTIMEVERIFY > opcode defined in
235231L<BIP65|https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki> should
236232be used.
237233
238- I<writer: > C<set_checklocktimeverify >
239-
240234=head3 checksequenceverify
241235
242- I<Available in the constructor > .
243-
244236Whether C<OP_CHECKSEQUENCEVERIFY > opcode defined in
245237L<BIP112|https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki> should
246238be used.
247239
248- I< writer: > C< set_checksequenceverify >
240+ =head3 null_dummy
249241
250- =head3 nulldummy
251-
252- I<Available in the constructor > .
253-
254- Whether C<OP_CHECKMULTISIG > nulldummy verification defined in
242+ Whether C<OP_CHECKMULTISIG > null dummy verification defined in
255243L<BIP147|https://github.com/bitcoin/bips/blob/master/bip-0147.mediawiki> should
256244be used.
257245
258- I<writer: > C<set_nulldummy >
259-
260246=head3 segwit
261247
262- I<Available in the constructor > .
263-
264248Whether segwit-specific verification defined in
265249L<BIP141|https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki> should
266250be used.
267251
268- I<writer: > C<set_segwit >
269-
270252=head3 taproot
271253
272- I<Available in the constructor > .
273-
274254Whether taproot-specific verification defined in
275255L<BIP341|https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki> should
276256be used.
277257
278- I<writer: > C<set_taproot >
258+ =head2 Standardness flags
259+
260+ All standardness flags are inactive by default.
261+
262+ =head3 signature_pushes_only
263+
264+ Disallows non-push opcodes in signature scripts of inputs for legacy non-P2SH
265+ transactions. Automatically active for P2SH.
266+
267+ =head3 minimal_if
268+
269+ Whether the argument to C<OP_IF > must be minimal (C<OP_1 > or C<OP_0 > ). Only
270+ applicable to Segregated Witness scripts.
271+
272+ =head3 compressed_pubkeys
273+
274+ Whether public keys used is signature-checking scripts must be compressed. Only
275+ applicable to Segregated Witness scripts.
276+
277+ =head3 strict_encoding
278+
279+ Disallows non-strictly encoded DER signatures and public keys.
280+
281+ =head3 low_s_signatures
282+
283+ Disallows signatures encoded with low S.
284+
285+ =head3 minimal_data
286+
287+ When active, data pushed by push opcodes must be minimally encoded.
288+
289+ =head3 null_fail
290+
291+ Causes non-taproot signature-checking opcodes to stop script execution on
292+ failure, unless the signature is empty.
293+
294+ =head3 clean_stack
295+
296+ Requires script stack to have exactly one element at the end of execution to
297+ consider the execution successful.
298+
299+ =head3 const_script
300+
301+ Causes the script to fail if C<OP_CODESEPARATOR > or a signature is encoded in a
302+ pre-SegWit script.
303+
304+ =head3 known_witness
305+
306+ Causes the transaction verification to fail if unknown version of Segregated
307+ Witness program is encountered.
308+
309+ =head3 illegal_upgradeable_nops
310+
311+ Disallows the use of C<OP_NOPX > opcodes (but not C<OP_NOP > ).
279312
280313=head2 Methods
281314
@@ -284,7 +317,7 @@ I<writer:> C<set_taproot>
284317 $object = $class->new(%args)
285318
286319This is a standard Moo constructor, which can be used to create the object. It
287- takes arguments specified in L</Attributes > .
320+ takes arguments specified in L</Consensus flags> and L</Standardness flags > .
288321
289322Returns a class instance.
290323
@@ -294,6 +327,20 @@ Returns a class instance.
294327
295328Same as L</new> , but assumes all flags unspecified in C<%args > are disabled.
296329
330+ =head3 new_full
331+
332+ $object = $class->new_full(%args)
333+
334+ Same as L</new> , but assumes all flags unspecified in C<%args > are enabled.
335+
336+ =head3 strict_signatures
337+
338+ $bool = $object->strict_signatures()
339+
340+ Return true if any one of L</strict_encoding> , L</der_signatures> or
341+ L</low_s_signatures> are enabled. Having either one of these flags in effect is
342+ the same as having L</der_signatures> enabled.
343+
297344=head1 SEE ALSO
298345
299346=over
0 commit comments