55
66namespace x42 . Networks . Policies
77{
8- /// <summary>
9- /// Blockcore sample coin-specific standard transaction definitions.
10- /// </summary>
11- public class x42StandardScriptsRegistry : StandardScriptsRegistry
12- {
13- // See MAX_OP_RETURN_RELAY in stratisX, <script.h>
14- public const int MaxOpReturnRelay = 40 ;
15-
16- // Need a network-specific version of the template list
17- private readonly List < ScriptTemplate > standardTemplates = new List < ScriptTemplate >
8+ /// <summary>
9+ /// x42 coin-specific standard transaction definitions.
10+ /// </summary>
11+ public class x42StandardScriptsRegistry : StandardScriptsRegistry
12+ {
13+ // See MAX_OP_RETURN_RELAY in Bitcoin Core, <script/standard.h.>
14+ // 80 bytes of data, +1 for OP_RETURN, +2 for the pushdata opcodes.
15+ public const int MaxOpReturnRelay = 83 ;
16+
17+ // Need a network-specific version of the template list
18+ private readonly List < ScriptTemplate > standardTemplates = new List < ScriptTemplate >
1819 {
1920 PayToPubkeyHashTemplate . Instance ,
2021 PayToPubkeyTemplate . Instance ,
@@ -24,39 +25,39 @@ public class x42StandardScriptsRegistry : StandardScriptsRegistry
2425 PayToWitTemplate . Instance
2526 } ;
2627
27- public override List < ScriptTemplate > GetScriptTemplates => standardTemplates ;
28-
29- public override void RegisterStandardScriptTemplate ( ScriptTemplate scriptTemplate )
30- {
31- if ( ! standardTemplates . Any ( template => ( template . Type == scriptTemplate . Type ) ) )
32- {
33- standardTemplates . Add ( scriptTemplate ) ;
34- }
35- }
36-
37- public override bool IsStandardTransaction ( Transaction tx , Network network )
38- {
39- return base . IsStandardTransaction ( tx , network ) ;
40- }
41-
42- public override bool AreOutputsStandard ( Network network , Transaction tx )
43- {
44- return base . AreOutputsStandard ( network , tx ) ;
45- }
46-
47- public override ScriptTemplate GetTemplateFromScriptPubKey ( Script script )
48- {
49- return standardTemplates . FirstOrDefault ( t => t . CheckScriptPubKey ( script ) ) ;
50- }
51-
52- public override bool IsStandardScriptPubKey ( Network network , Script scriptPubKey )
53- {
54- return base . IsStandardScriptPubKey ( network , scriptPubKey ) ;
55- }
56-
57- public override bool AreInputsStandard ( Network network , Transaction tx , CoinsView coinsView )
58- {
59- return base . AreInputsStandard ( network , tx , coinsView ) ;
60- }
61- }
28+ public override List < ScriptTemplate > GetScriptTemplates => this . standardTemplates ;
29+
30+ public override void RegisterStandardScriptTemplate ( ScriptTemplate scriptTemplate )
31+ {
32+ if ( ! this . standardTemplates . Any ( template => ( template . Type == scriptTemplate . Type ) ) )
33+ {
34+ this . standardTemplates . Add ( scriptTemplate ) ;
35+ }
36+ }
37+
38+ public override bool IsStandardTransaction ( Transaction tx , Network network )
39+ {
40+ return base . IsStandardTransaction ( tx , network ) ;
41+ }
42+
43+ public override bool AreOutputsStandard ( Network network , Transaction tx )
44+ {
45+ return base . AreOutputsStandard ( network , tx ) ;
46+ }
47+
48+ public override ScriptTemplate GetTemplateFromScriptPubKey ( Script script )
49+ {
50+ return this . standardTemplates . FirstOrDefault ( t => t . CheckScriptPubKey ( script ) ) ;
51+ }
52+
53+ public override bool IsStandardScriptPubKey ( Network network , Script scriptPubKey )
54+ {
55+ return base . IsStandardScriptPubKey ( network , scriptPubKey ) ;
56+ }
57+
58+ public override bool AreInputsStandard ( Network network , Transaction tx , CoinsView coinsView )
59+ {
60+ return base . AreInputsStandard ( network , tx , coinsView ) ;
61+ }
62+ }
6263}
0 commit comments