diff --git a/DashSync/Categories/NSData+Bitcoin.h b/DashSync/Categories/NSData+Bitcoin.h
index 5d17055ad..af3fd82a3 100644
--- a/DashSync/Categories/NSData+Bitcoin.h
+++ b/DashSync/Categories/NSData+Bitcoin.h
@@ -168,6 +168,9 @@ size_t chacha20Poly1305AEADDecrypt(void *_Nullable out, size_t outLen, const voi
- (UInt128)UInt128AtOffset:(NSUInteger)offset;
- (UInt160)UInt160AtOffset:(NSUInteger)offset;
- (UInt256)UInt256AtOffset:(NSUInteger)offset;
+- (UInt384)UInt384AtOffset:(NSUInteger)offset;
+- (UInt512)UInt512AtOffset:(NSUInteger)offset;
+- (UInt768)UInt768AtOffset:(NSUInteger)offset;
- (UInt128)UInt128;
- (UInt160)UInt160;
- (UInt256)UInt256;
diff --git a/DashSync/Categories/NSData+Bitcoin.m b/DashSync/Categories/NSData+Bitcoin.m
index 57b43d80d..a93c55927 100644
--- a/DashSync/Categories/NSData+Bitcoin.m
+++ b/DashSync/Categories/NSData+Bitcoin.m
@@ -1127,18 +1127,35 @@ - (UInt256)UInt256
return *(UInt256 *)(self.bytes);
}
+- (UInt384)UInt384AtOffset:(NSUInteger)offset
+{
+ if (self.length < offset + sizeof(UInt384)) return UINT384_ZERO;
+ return *(UInt384 *)(self.bytes + offset);
+}
+
- (UInt384)UInt384
{
if (self.length < sizeof(UInt384)) return UINT384_ZERO;
return *(UInt384 *)(self.bytes);
}
+- (UInt512)UInt512AtOffset:(NSUInteger)offset
+{
+ if (self.length < offset + sizeof(UInt512)) return UINT512_ZERO;
+ return *(UInt512 *)(self.bytes + offset);
+}
+
- (UInt512)UInt512
{
if (self.length < sizeof(UInt512)) return UINT512_ZERO;
return *(UInt512 *)(self.bytes);
}
+- (UInt768)UInt768AtOffset:(NSUInteger)offset
+{
+ if (self.length < offset + sizeof(UInt768)) return UINT768_ZERO;
+ return *(UInt768 *)(self.bytes + offset);
+}
- (UInt768)UInt768
{
diff --git a/DashSync/Categories/NSMutableData+Dash.h b/DashSync/Categories/NSMutableData+Dash.h
index 250fbeff9..8346863b7 100644
--- a/DashSync/Categories/NSMutableData+Dash.h
+++ b/DashSync/Categories/NSMutableData+Dash.h
@@ -54,6 +54,9 @@ CF_IMPLICIT_BRIDGING_DISABLED
- (void)appendUInt128:(UInt128)i;
- (void)appendUInt160:(UInt160)i;
- (void)appendUInt256:(UInt256)i;
+- (void)appendUInt384:(UInt384)i;
+- (void)appendUInt512:(UInt512)i;
+- (void)appendUInt768:(UInt768)i;
- (void)appendVarInt:(uint64_t)i;
- (void)appendString:(NSString *)s;
diff --git a/DashSync/Categories/NSMutableData+Dash.m b/DashSync/Categories/NSMutableData+Dash.m
index 1eea56b8c..41d455dd2 100644
--- a/DashSync/Categories/NSMutableData+Dash.m
+++ b/DashSync/Categories/NSMutableData+Dash.m
@@ -159,6 +159,22 @@ - (void)appendUInt256:(UInt256)i
[self appendBytes:&i length:sizeof(i)];
}
+- (void)appendUInt384:(UInt384)i
+{
+ [self appendBytes:&i length:sizeof(i)];
+}
+
+- (void)appendUInt512:(UInt512)i
+{
+ [self appendBytes:&i length:sizeof(i)];
+}
+
+- (void)appendUInt768:(UInt768)i
+{
+ [self appendBytes:&i length:sizeof(i)];
+}
+
+
- (void)appendVarInt:(uint64_t)i
{
diff --git a/DashSync/DashSync.xcdatamodeld/DashSync 1.xcdatamodel/contents b/DashSync/DashSync.xcdatamodeld/DashSync 1.xcdatamodel/contents
index c7d403f0c..0a672dec0 100644
--- a/DashSync/DashSync.xcdatamodeld/DashSync 1.xcdatamodel/contents
+++ b/DashSync/DashSync.xcdatamodeld/DashSync 1.xcdatamodel/contents
@@ -169,9 +169,10 @@
+
-
+
@@ -190,6 +191,11 @@
+
+
+
+
+
@@ -264,7 +270,7 @@
-
+
diff --git a/DashSync/Models/DSSimplifiedMasternodeEntry.h b/DashSync/Models/DSSimplifiedMasternodeEntry.h
index 7de1d7d41..1f90103ee 100644
--- a/DashSync/Models/DSSimplifiedMasternodeEntry.h
+++ b/DashSync/Models/DSSimplifiedMasternodeEntry.h
@@ -13,9 +13,10 @@
@interface DSSimplifiedMasternodeEntry : NSObject
@property(nonatomic,readonly) UInt256 providerRegistrationTransactionHash;
+@property(nonatomic,readonly) UInt256 confirmedHash;
@property(nonatomic,readonly) UInt128 address;
@property(nonatomic,readonly) uint16_t port;
-@property(nonatomic,readonly) UInt160 keyIDOperator;
+@property(nonatomic,readonly) UInt384 operatorBLSPublicKey;
@property(nonatomic,readonly) UInt160 keyIDVoting;
@property(nonatomic,readonly) BOOL isValid;
@property(nonatomic,readonly) UInt256 simplifiedMasternodeEntryHash;
@@ -26,8 +27,8 @@
+(instancetype)simplifiedMasternodeEntryWithData:(NSData*)data onChain:(DSChain*)chain;
-+(instancetype)simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:(UInt256)providerRegistrationTransactionHash address:(UInt128)address port:(uint16_t)port keyIDOperator:(UInt160)keyIDOperator keyIDVoting:(UInt160)keyIDVoting isValid:(BOOL)isValid onChain:(DSChain*)chain;
++(instancetype)simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:(UInt256)providerRegistrationTransactionHash confirmedHash:(UInt256)confirmedHash address:(UInt128)address port:(uint16_t)port operatorBLSPublicKey:(UInt384)operatorBLSPublicKey keyIDVoting:(UInt160)keyIDVoting isValid:(BOOL)isValid onChain:(DSChain*)chain;
-+(instancetype)simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:(UInt256)providerRegistrationTransactionHash address:(UInt128)address port:(uint16_t)port keyIDOperator:(UInt160)keyIDOperator keyIDVoting:(UInt160)keyIDVoting isValid:(BOOL)isValid simplifiedMasternodeEntryHash:(UInt256)simplifiedMasternodeEntryHash onChain:(DSChain*)chain;
++(instancetype)simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:(UInt256)providerRegistrationTransactionHash confirmedHash:(UInt256)confirmedHash address:(UInt128)address port:(uint16_t)port operatorBLSPublicKey:(UInt384)operatorBLSPublicKey keyIDVoting:(UInt160)keyIDVoting isValid:(BOOL)isValid simplifiedMasternodeEntryHash:(UInt256)simplifiedMasternodeEntryHash onChain:(DSChain*)chain;
@end
diff --git a/DashSync/Models/DSSimplifiedMasternodeEntry.m b/DashSync/Models/DSSimplifiedMasternodeEntry.m
index 045df4be3..2cf697930 100644
--- a/DashSync/Models/DSSimplifiedMasternodeEntry.m
+++ b/DashSync/Models/DSSimplifiedMasternodeEntry.m
@@ -14,10 +14,11 @@
@interface DSSimplifiedMasternodeEntry()
@property(nonatomic,assign) UInt256 providerRegistrationTransactionHash;
+@property(nonatomic,assign) UInt256 confirmedHash;
@property(nonatomic,assign) UInt256 simplifiedMasternodeEntryHash;
@property(nonatomic,assign) UInt128 address;
@property(nonatomic,assign) uint16_t port;
-@property(nonatomic,assign) UInt160 keyIDOperator;
+@property(nonatomic,assign) UInt384 operatorBLSPublicKey;
@property(nonatomic,assign) UInt160 keyIDVoting;
@property(nonatomic,assign) BOOL isValid;
@property(nonatomic,strong) DSChain * chain;
@@ -30,10 +31,11 @@ @implementation DSSimplifiedMasternodeEntry
-(NSData*)payloadData {
NSMutableData * hashImportantData = [NSMutableData data];
[hashImportantData appendUInt256:self.providerRegistrationTransactionHash];
+ [hashImportantData appendUInt256:self.confirmedHash];
[hashImportantData appendUInt128:self.address];
[hashImportantData appendUInt16:CFSwapInt16HostToBig(self.port)];
- [hashImportantData appendUInt160:self.keyIDOperator];
+ [hashImportantData appendUInt384:self.operatorBLSPublicKey];
[hashImportantData appendUInt160:self.keyIDVoting];
[hashImportantData appendUInt8:self.isValid];
return [hashImportantData copy];
@@ -47,17 +49,18 @@ +(instancetype)simplifiedMasternodeEntryWithData:(NSData*)data onChain:(DSChain*
return [[self alloc] initWithMessage:data onChain:chain];
}
-+(instancetype)simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:(UInt256)providerRegistrationTransactionHash address:(UInt128)address port:(uint16_t)port keyIDOperator:(UInt160)keyIDOperator keyIDVoting:(UInt160)keyIDVoting isValid:(BOOL)isValid onChain:(DSChain*)chain {
- return [self simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:providerRegistrationTransactionHash address:address port:port keyIDOperator:keyIDOperator keyIDVoting:keyIDVoting isValid:isValid simplifiedMasternodeEntryHash:UINT256_ZERO onChain:chain];
++(instancetype)simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:(UInt256)providerRegistrationTransactionHash confirmedHash:(UInt256)confirmedHash address:(UInt128)address port:(uint16_t)port operatorBLSPublicKey:(UInt384)operatorBLSPublicKey keyIDVoting:(UInt160)keyIDVoting isValid:(BOOL)isValid onChain:(DSChain*)chain {
+ return [self simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:providerRegistrationTransactionHash confirmedHash:confirmedHash address:address port:port operatorBLSPublicKey:operatorBLSPublicKey keyIDVoting:keyIDVoting isValid:isValid simplifiedMasternodeEntryHash:UINT256_ZERO onChain:chain];
}
-+(instancetype)simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:(UInt256)providerRegistrationTransactionHash address:(UInt128)address port:(uint16_t)port keyIDOperator:(UInt160)keyIDOperator keyIDVoting:(UInt160)keyIDVoting isValid:(BOOL)isValid simplifiedMasternodeEntryHash:(UInt256)simplifiedMasternodeEntryHash onChain:(DSChain*)chain {
++(instancetype)simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:(UInt256)providerRegistrationTransactionHash confirmedHash:(UInt256)confirmedHash address:(UInt128)address port:(uint16_t)port operatorBLSPublicKey:(UInt384)operatorBLSPublicKey keyIDVoting:(UInt160)keyIDVoting isValid:(BOOL)isValid simplifiedMasternodeEntryHash:(UInt256)simplifiedMasternodeEntryHash onChain:(DSChain*)chain {
DSSimplifiedMasternodeEntry * simplifiedMasternodeEntry = [[DSSimplifiedMasternodeEntry alloc] init];
simplifiedMasternodeEntry.providerRegistrationTransactionHash = providerRegistrationTransactionHash;
+ simplifiedMasternodeEntry.confirmedHash = confirmedHash;
simplifiedMasternodeEntry.address = address;
simplifiedMasternodeEntry.port = port;
simplifiedMasternodeEntry.keyIDVoting = keyIDVoting;
- simplifiedMasternodeEntry.keyIDOperator = keyIDOperator;
+ simplifiedMasternodeEntry.operatorBLSPublicKey = operatorBLSPublicKey;
simplifiedMasternodeEntry.isValid = isValid;
simplifiedMasternodeEntry.simplifiedMasternodeEntryHash = !uint256_is_zero(simplifiedMasternodeEntryHash)?simplifiedMasternodeEntryHash:[simplifiedMasternodeEntry calculateSimplifiedMasternodeEntryHash];
simplifiedMasternodeEntry.chain = chain;
@@ -72,6 +75,10 @@ -(instancetype)initWithMessage:(NSData*)message onChain:(DSChain*)chain {
self.providerRegistrationTransactionHash = [message UInt256AtOffset:offset];
offset += 32;
+ if (length - offset < 32) return nil;
+ self.confirmedHash = [message UInt256AtOffset:offset];
+ offset += 32;
+
if (length - offset < 16) return nil;
self.address = [message UInt128AtOffset:offset];
offset += 16;
@@ -80,9 +87,9 @@ -(instancetype)initWithMessage:(NSData*)message onChain:(DSChain*)chain {
self.port = CFSwapInt16HostToBig([message UInt16AtOffset:offset]);
offset += 2;
- if (length - offset < 20) return nil;
- self.keyIDOperator = [message UInt160AtOffset:offset];
- offset += 20;
+ if (length - offset < 48) return nil;
+ self.operatorBLSPublicKey = [message UInt384AtOffset:offset];
+ offset += 48;
if (length - offset < 20) return nil;
self.keyIDVoting = [message UInt160AtOffset:offset];
diff --git a/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataClass.m b/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataClass.m
index 611251487..e985ee6b3 100644
--- a/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataClass.m
+++ b/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataClass.m
@@ -19,17 +19,18 @@ - (void)updateAttributesFromSimplifiedMasternodeEntry:(DSSimplifiedMasternodeEnt
self.address = CFSwapInt32BigToHost(simplifiedMasternodeEntry.address.u32[3]);
self.port = simplifiedMasternodeEntry.port;
self.keyIDVoting = [NSData dataWithUInt160:simplifiedMasternodeEntry.keyIDVoting];
- self.keyIDOperator = [NSData dataWithUInt160:simplifiedMasternodeEntry.keyIDOperator];
+ self.operatorBLSPublicKey = [NSData dataWithUInt384:simplifiedMasternodeEntry.operatorBLSPublicKey];
self.isValid = simplifiedMasternodeEntry.isValid;
self.simplifiedMasternodeEntryHash = [NSData dataWithUInt256:simplifiedMasternodeEntry.simplifiedMasternodeEntryHash];
}
- (void)setAttributesFromSimplifiedMasternodeEntry:(DSSimplifiedMasternodeEntry *)simplifiedMasternodeEntry onChain:(DSChainEntity*)chainEntity {
self.providerRegistrationTransactionHash = [NSData dataWithUInt256:simplifiedMasternodeEntry.providerRegistrationTransactionHash];
+ self.confirmedHash = [NSData dataWithUInt256:simplifiedMasternodeEntry.confirmedHash];
self.address = CFSwapInt32BigToHost(simplifiedMasternodeEntry.address.u32[3]);
self.port = simplifiedMasternodeEntry.port;
self.keyIDVoting = [NSData dataWithUInt160:simplifiedMasternodeEntry.keyIDVoting];
- self.keyIDOperator = [NSData dataWithUInt160:simplifiedMasternodeEntry.keyIDOperator];
+ self.operatorBLSPublicKey = [NSData dataWithUInt384:simplifiedMasternodeEntry.operatorBLSPublicKey];
self.isValid = simplifiedMasternodeEntry.isValid;
self.simplifiedMasternodeEntryHash = [NSData dataWithUInt256:simplifiedMasternodeEntry.simplifiedMasternodeEntryHash];
if (!chainEntity) {
@@ -60,7 +61,7 @@ + (DSSimplifiedMasternodeEntryEntity*)simplifiedMasternodeEntryForHash:(NSData*)
- (DSSimplifiedMasternodeEntry*)simplifiedMasternodeEntry {
UInt128 address = { .u32 = { 0, 0, CFSwapInt32HostToBig(0xffff), CFSwapInt32HostToBig(self.address) } };
- DSSimplifiedMasternodeEntry * simplifiedMasternodeEntry = [DSSimplifiedMasternodeEntry simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:[self.providerRegistrationTransactionHash UInt256AtOffset:0] address:address port:self.port keyIDOperator:[self.keyIDOperator UInt160AtOffset:0] keyIDVoting:[self.keyIDVoting UInt160AtOffset:0] isValid:self.isValid simplifiedMasternodeEntryHash:[self.simplifiedMasternodeEntryHash UInt256AtOffset:0] onChain:self.chain.chain];
+ DSSimplifiedMasternodeEntry * simplifiedMasternodeEntry = [DSSimplifiedMasternodeEntry simplifiedMasternodeEntryWithProviderRegistrationTransactionHash:[self.providerRegistrationTransactionHash UInt256] confirmedHash:[self.confirmedHash UInt256] address:address port:self.port operatorBLSPublicKey:[self.operatorBLSPublicKey UInt384] keyIDVoting:[self.keyIDVoting UInt160AtOffset:0] isValid:self.isValid simplifiedMasternodeEntryHash:[self.simplifiedMasternodeEntryHash UInt256AtOffset:0] onChain:self.chain.chain];
return simplifiedMasternodeEntry;
}
diff --git a/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataProperties.h b/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataProperties.h
index e0d9c1251..7e97c9de3 100644
--- a/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataProperties.h
+++ b/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataProperties.h
@@ -16,10 +16,11 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSFetchRequest *)fetchRequest;
@property (nullable, nonatomic, retain) NSData *providerRegistrationTransactionHash;
+@property (nullable, nonatomic, retain) NSData *confirmedHash;
@property (nonatomic, assign) uint32_t address;
@property (nonatomic, assign) uint16_t port;
@property (nonatomic, assign) BOOL claimed;
-@property (nullable, nonatomic, retain) NSData *keyIDOperator;
+@property (nullable, nonatomic, retain) NSData *operatorBLSPublicKey;
@property (nullable, nonatomic, retain) NSData *keyIDVoting;
@property (nonatomic, assign) Boolean isValid;
@property (nullable, nonatomic, retain) NSData *simplifiedMasternodeEntryHash;
diff --git a/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataProperties.m b/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataProperties.m
index 2d67237cd..9cac058a7 100644
--- a/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataProperties.m
+++ b/DashSync/Models/Entities/DSSimplifiedMasternodeEntryEntity+CoreDataProperties.m
@@ -15,9 +15,10 @@ @implementation DSSimplifiedMasternodeEntryEntity (CoreDataProperties)
}
@dynamic providerRegistrationTransactionHash;
+@dynamic confirmedHash;
@dynamic address;
@dynamic port;
-@dynamic keyIDOperator;
+@dynamic operatorBLSPublicKey;
@dynamic keyIDVoting;
@dynamic isValid;
@dynamic simplifiedMasternodeEntryHash;