Skip to content

Commit bdbe18a

Browse files
authored
Merge pull request #522 from dashpay/develop
Develop
2 parents c553d04 + 101cfe6 commit bdbe18a

83 files changed

Lines changed: 1666 additions & 886 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DashSync.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Pod::Spec.new do |s|
3434
s.ios.framework = 'UIKit'
3535
s.macos.framework = 'Cocoa'
3636
s.compiler_flags = '-Wno-comma'
37-
s.dependency 'DashSharedCore', '0.4.11'
37+
s.dependency 'DashSharedCore', '0.4.15'
3838
s.dependency 'CocoaLumberjack', '3.7.2'
3939
s.ios.dependency 'DWAlertController', '0.2.1'
4040
s.dependency 'DSDynamicOptions', '0.1.2'

DashSync/shared/Categories/NSData/NSData+Dash.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ size_t chacha20Poly1305AEADDecrypt(void *_Nullable out, size_t outLen, const voi
193193
- (uint32_t)UInt32AtOffset:(NSUInteger)offset;
194194
- (uint32_t)UInt32BigToHostAtOffset:(NSUInteger)offset;
195195
- (uint64_t)UInt64AtOffset:(NSUInteger)offset;
196+
- (int64_t)Int64AtOffset:(NSUInteger)offset;
196197
- (UInt128)UInt128AtOffset:(NSUInteger)offset;
197198
- (UInt160)UInt160AtOffset:(NSUInteger)offset;
198199
- (UInt256)UInt256AtOffset:(NSUInteger)offset;

DashSync/shared/Categories/NSData/NSData+Dash.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,11 @@ - (uint64_t)UInt64AtOffset:(NSUInteger)offset {
12111211
return CFSwapInt64LittleToHost(*(const uint64_t *)((const uint8_t *)self.bytes + offset));
12121212
}
12131213

1214+
- (int64_t)Int64AtOffset:(NSUInteger)offset {
1215+
if (self.length < offset + sizeof(int64_t)) return 0;
1216+
return CFSwapInt64LittleToHost(*(const int64_t *)((const uint8_t *)self.bytes + offset));
1217+
}
1218+
12141219
- (UInt128)UInt128AtOffset:(NSUInteger)offset {
12151220
if (self.length < offset + sizeof(UInt128)) return UINT128_ZERO;
12161221
return *(UInt128 *)(self.bytes + offset);

DashSync/shared/Categories/NSData/NSMutableData+Dash.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static void secureDeallocate(void *ptr, void *info) {
6565
}
6666

6767
// Since iOS does not page memory to storage, all we need to do is cleanse allocated memory prior to deallocation.
68-
CFAllocatorRef SecureAllocator() {
68+
CFAllocatorRef SecureAllocator(void) {
6969
static CFAllocatorRef alloc = NULL;
7070
static dispatch_once_t onceToken = 0;
7171

DashSync/shared/DashSync.xcdatamodeld/.xccurrentversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<plist version="1.0">
44
<dict>
55
<key>_XCCurrentVersionName</key>
6-
<string>DashSync 19.xcdatamodel</string>
6+
<string>DashSync 20.xcdatamodel</string>
77
</dict>
88
</plist>

DashSync/shared/DashSync.xcdatamodeld/DashSync 20.xcdatamodel/contents

Lines changed: 518 additions & 0 deletions
Large diffs are not rendered by default.

DashSync/shared/Libraries/DSLogger.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919

2020
NS_ASSUME_NONNULL_BEGIN
2121

22+
@interface NoTimestampLogFormatter : NSObject <DDLogFormatter>
23+
@end
24+
@implementation NoTimestampLogFormatter
25+
- (nullable NSString *)formatLogMessage:(DDLogMessage *)logMessage {
26+
return logMessage.message;
27+
}
28+
@end
29+
2230
@interface DSLogger ()
2331

2432
@property (readonly, nonatomic, strong) DDFileLogger *fileLogger;
@@ -44,6 +52,7 @@ - (instancetype)init {
4452
DDFileLogger *fileLogger = [[DDFileLogger alloc] init];
4553
fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
4654
fileLogger.logFileManager.maximumNumberOfLogFiles = 3; // keep a 3 days worth of log files
55+
//[fileLogger setLogFormatter:[[NoTimestampLogFormatter alloc] init]]; // Use the custom formatter
4756
[DDLog addLogger:fileLogger];
4857
_fileLogger = fileLogger;
4958
}

DashSync/shared/Libraries/Networking/Private/SPTDataLoaderExponentialTimer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ - (NSTimeInterval)timeIntervalAndCalculateNext {
128128

129129
#define EXPT_MODULO ((u_int32_t)RAND_MAX)
130130
#define EXPT_MODULO_F64 ((double)(EXPT_MODULO))
131-
NS_INLINE double SPTExptRandom() {
131+
NS_INLINE double SPTExptRandom(void) {
132132
// We need [0, 1) interval
133133
return arc4random_uniform(EXPT_MODULO);
134134
}

DashSync/shared/Models/Chain/DSBlock.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ - (BOOL)canCalculateDifficultyWithPreviousBlocks:(NSDictionary *)previousBlocks
133133
}
134134
currentBlock = previousBlocks[uint256_obj(currentBlock.prevBlock)];
135135
if (!currentBlock) {
136-
DSLog(@"Could not retrieve previous block");
136+
DSLog(@"[%@] Could not retrieve previous block", self.chain.name);
137137
return FALSE;
138138
}
139139
}
@@ -150,7 +150,7 @@ - (BOOL)verifyDifficultyWithPreviousBlocks:(NSDictionary *)previousBlocks rDiffi
150150
}
151151
int32_t diff = self.target - darkGravityWaveTarget;
152152
if (abs(diff) > 1) {
153-
DSLog(@"weird difficulty for block at height %u with target %@ (off by %u)", self.height, uint256_hex(setCompactBE(self.target)), diff);
153+
DSLog(@"[%@] weird difficulty for block at height %u with target %@ (off by %u)", self.chain.name, self.height, uint256_hex(setCompactBE(self.target)), diff);
154154
}
155155
return (abs(diff) < 2); //the core client is less precise with a rounding error that can sometimes cause a problem. We are very rarely 1 off
156156
}
@@ -173,7 +173,7 @@ - (int32_t)darkGravityWaveTargetWithPreviousBlocks:(NSDictionary *)previousBlock
173173
if (self.chain.allowMinDifficultyBlocks) {
174174
// recent block is more than 2 hours old
175175
if (self.timestamp > (previousBlock.timestamp + 2 * 60 * 60)) {
176-
DSLog(@"Our block is way ahead of previous block %d > %d", self.timestamp, previousBlock.timestamp);
176+
DSLog(@"[%@] Our block is way ahead of previous block %d > %d", self.chain.name, self.timestamp, previousBlock.timestamp);
177177
return self.chain.maxProofOfWorkTarget;
178178
}
179179
// recent block is more than 10 minutes old
@@ -218,7 +218,7 @@ - (int32_t)darkGravityWaveTargetWithPreviousBlocks:(NSDictionary *)previousBlock
218218
DSBlock *oldCurrentBlock = currentBlock;
219219
currentBlock = previousBlocks[uint256_obj(currentBlock.prevBlock)];
220220
if (!currentBlock) {
221-
DSLog(@"Block %d missing for dark gravity wave calculation", oldCurrentBlock.height - 1);
221+
DSLog(@"[%@] Block %d missing for dark gravity wave calculation", self.chain.name, oldCurrentBlock.height - 1);
222222
}
223223
}
224224
UInt256 blockCount256 = ((UInt256){.u64 = {blockCount, 0, 0, 0}});

DashSync/shared/Models/Chain/DSChain.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,8 @@ typedef NS_ENUM(uint16_t, DSChainSyncPhase)
480480
- (BOOL)isEvolutionEnabled;
481481
- (BOOL)isDevnetWithGenesisHash:(UInt256)genesisHash;
482482
- (BOOL)isCore19Active;
483+
- (BOOL)isCore20Active;
484+
- (BOOL)isCore20ActiveAtHeight:(uint32_t)height;
483485
- (KeyKind)activeBLSType;
484486

485487
@end

0 commit comments

Comments
 (0)