66#define BITCOIN_EVO_PROVIDERTX_H
77
88#include < bls/bls.h>
9+ #include < evo/common.h>
910#include < evo/netinfo.h>
1011#include < evo/specialtx.h>
1112#include < primitives/transaction.h>
2021
2122class TxValidationState ;
2223
23- namespace ProTxVersion {
24- enum : uint16_t {
25- LegacyBLS = 1 ,
26- BasicBLS = 2 ,
27- };
28- } // namespace ProTxVersion
29-
3024class CProRegTx
3125{
3226public:
3327 static constexpr auto SPECIALTX_TYPE = TRANSACTION_PROVIDER_REGISTER;
3428
35- [[nodiscard]] static constexpr uint16_t GetMaxVersion (const bool is_basic_scheme_active)
29+ [[nodiscard]] static constexpr uint16_t GetMaxVersion (const bool is_basic_scheme_active, const bool is_extended_addr )
3630 {
37- return is_basic_scheme_active ? ProTxVersion::BasicBLS : ProTxVersion::LegacyBLS;
31+ return is_extended_addr ? ProTxVersion::ExtAddr
32+ : (is_basic_scheme_active ? ProTxVersion::BasicBLS : ProTxVersion::LegacyBLS);
3833 }
3934
4035 uint16_t nVersion{ProTxVersion::LegacyBLS}; // message version
@@ -58,7 +53,7 @@ class CProRegTx
5853 READWRITE (
5954 obj.nVersion
6055 );
61- if (obj.nVersion == 0 || obj.nVersion > GetMaxVersion (/* is_basic_scheme_active=*/ true )) {
56+ if (obj.nVersion == 0 || obj.nVersion > GetMaxVersion (/* is_basic_scheme_active=*/ true , /* is_extended_addr= */ true )) {
6257 // unknown version, bail out early
6358 return ;
6459 }
@@ -67,7 +62,7 @@ class CProRegTx
6762 obj.nType ,
6863 obj.nMode ,
6964 obj.collateralOutpoint ,
70- NetInfoSerWrapper (const_cast <std::shared_ptr<NetInfoInterface>&>(obj.netInfo )),
65+ NetInfoSerWrapper (const_cast <std::shared_ptr<NetInfoInterface>&>(obj.netInfo ), obj. nVersion >= ProTxVersion::ExtAddr ),
7166 obj.keyIDOwner ,
7267 CBLSLazyPublicKeyVersionWrapper (const_cast <CBLSLazyPublicKey&>(obj.pubKeyOperator ), (obj.nVersion == ProTxVersion::LegacyBLS)),
7368 obj.keyIDVoting ,
@@ -94,17 +89,18 @@ class CProRegTx
9489
9590 [[nodiscard]] UniValue ToJson () const ;
9691
97- bool IsTriviallyValid (bool is_basic_scheme_active, TxValidationState& state) const ;
92+ bool IsTriviallyValid (bool is_basic_scheme_active, bool is_extended_addr, TxValidationState& state) const ;
9893};
9994
10095class CProUpServTx
10196{
10297public:
10398 static constexpr auto SPECIALTX_TYPE = TRANSACTION_PROVIDER_UPDATE_SERVICE;
10499
105- [[nodiscard]] static constexpr uint16_t GetMaxVersion (const bool is_basic_scheme_active)
100+ [[nodiscard]] static constexpr uint16_t GetMaxVersion (const bool is_basic_scheme_active, const bool is_extended_addr )
106101 {
107- return is_basic_scheme_active ? ProTxVersion::BasicBLS : ProTxVersion::LegacyBLS;
102+ return is_extended_addr ? ProTxVersion::ExtAddr
103+ : (is_basic_scheme_active ? ProTxVersion::BasicBLS : ProTxVersion::LegacyBLS);
108104 }
109105
110106 uint16_t nVersion{ProTxVersion::LegacyBLS}; // message version
@@ -123,7 +119,7 @@ class CProUpServTx
123119 READWRITE (
124120 obj.nVersion
125121 );
126- if (obj.nVersion == 0 || obj.nVersion > GetMaxVersion (/* is_basic_scheme_active=*/ true )) {
122+ if (obj.nVersion == 0 || obj.nVersion > GetMaxVersion (/* is_basic_scheme_active=*/ true , /* is_extended_addr= */ true )) {
127123 // unknown version, bail out early
128124 return ;
129125 }
@@ -133,7 +129,7 @@ class CProUpServTx
133129 }
134130 READWRITE (
135131 obj.proTxHash ,
136- NetInfoSerWrapper (const_cast <std::shared_ptr<NetInfoInterface>&>(obj.netInfo )),
132+ NetInfoSerWrapper (const_cast <std::shared_ptr<NetInfoInterface>&>(obj.netInfo ), obj. nVersion >= ProTxVersion::ExtAddr ),
137133 obj.scriptOperatorPayout ,
138134 obj.inputsHash
139135 );
@@ -154,7 +150,7 @@ class CProUpServTx
154150
155151 [[nodiscard]] UniValue ToJson () const ;
156152
157- bool IsTriviallyValid (bool is_basic_scheme_active, TxValidationState& state) const ;
153+ bool IsTriviallyValid (bool is_basic_scheme_active, bool is_extended_addr, TxValidationState& state) const ;
158154};
159155
160156class CProUpRegTx
@@ -204,7 +200,7 @@ class CProUpRegTx
204200
205201 [[nodiscard]] UniValue ToJson () const ;
206202
207- bool IsTriviallyValid (bool is_basic_scheme_active, TxValidationState& state) const ;
203+ bool IsTriviallyValid (bool is_basic_scheme_active, bool is_extended_addr, TxValidationState& state) const ;
208204};
209205
210206class CProUpRevTx
@@ -257,7 +253,7 @@ class CProUpRevTx
257253
258254 [[nodiscard]] UniValue ToJson () const ;
259255
260- bool IsTriviallyValid (bool is_basic_scheme_active, TxValidationState& state) const ;
256+ bool IsTriviallyValid (bool is_basic_scheme_active, bool is_extended_addr, TxValidationState& state) const ;
261257};
262258
263259template <typename ProTx>
@@ -270,5 +266,4 @@ static bool CheckInputsHash(const CTransaction& tx, const ProTx& proTx, TxValida
270266 return true ;
271267}
272268
273-
274269#endif // BITCOIN_EVO_PROVIDERTX_H
0 commit comments