@@ -148,12 +148,14 @@ SimplifiedMNListEntry.prototype.toBuffer = function toBuffer() {
148
148
) ;
149
149
bufferWriter . writeUInt8 ( Number ( this . isValid ) ) ;
150
150
151
- if ( typeof this . nType === 'number' ) {
152
- bufferWriter . writeUInt16LE ( this . nType ) ;
153
-
154
- if ( this . nType === MASTERNODE_TYPE_HP ) {
155
- bufferWriter . writeUInt16LE ( this . platformHTTPPort ) ;
156
- bufferWriter . write ( Buffer . from ( this . platformNodeID , 'hex' ) . reverse ( ) ) ;
151
+ if ( this . nVersion === 2 ) {
152
+ if ( typeof this . nType === 'number' ) {
153
+ bufferWriter . writeUInt16LE ( this . nType ) ;
154
+
155
+ if ( this . nType === MASTERNODE_TYPE_HP ) {
156
+ bufferWriter . writeUInt16LE ( this . platformHTTPPort ) ;
157
+ bufferWriter . write ( Buffer . from ( this . platformNodeID , 'hex' ) . reverse ( ) ) ;
158
+ }
157
159
}
158
160
}
159
161
@@ -239,9 +241,12 @@ SimplifiedMNListEntry.prototype.toObject = function toObject() {
239
241
pubKeyOperator : this . pubKeyOperator ,
240
242
votingAddress : this . votingAddress ,
241
243
isValid : this . isValid ,
242
- nVersion : this . nVersion ,
243
244
} ;
244
245
246
+ if ( typeof this . nVersion === 'number' ) {
247
+ result . nVersion = this . nVersion ;
248
+ }
249
+
245
250
if ( typeof this . nType === 'number' ) {
246
251
result . nType = this . nType ;
247
252
}
@@ -262,10 +267,6 @@ SimplifiedMNListEntry.prototype.toObject = function toObject() {
262
267
result . platformNodeID = this . platformNodeID ;
263
268
}
264
269
265
- if ( typeof this . nVersion === 'number' ) {
266
- result . nVersion = this . nVersion ;
267
- }
268
-
269
270
return result ;
270
271
} ;
271
272
@@ -302,7 +303,7 @@ SimplifiedMNListEntry.prototype.confirmedHashWithProRegTxHash =
302
303
* @return {SimplifiedMNListEntry }
303
304
*/
304
305
SimplifiedMNListEntry . prototype . copy = function copy ( ) {
305
- return SimplifiedMNListEntry . fromObject ( _ . clone ( this . toObject ( ) ) , this . network ) ;
306
+ return _ . cloneDeep ( this ) ;
306
307
} ;
307
308
308
309
module . exports = SimplifiedMNListEntry ;
0 commit comments