@@ -39,7 +39,6 @@ extern bool WalletOutOfSync();
39
39
extern bool AskForOutstandingBlocks (uint256 hashStart);
40
40
extern void ResetTimerMain (std::string timer_name);
41
41
extern bool GridcoinServices ();
42
- std::string GetCommandNonce (std::string command);
43
42
44
43
unsigned int nNodeLifespan;
45
44
@@ -4383,12 +4382,6 @@ std::string NodeAddress(CNode* pfrom)
4383
4382
return ip;
4384
4383
}
4385
4384
4386
- bool SecurityTest (CNode* pfrom, bool acid_test)
4387
- {
4388
- if (pfrom->nStartingHeight > (nBestHeight*.5 ) && acid_test) return true ;
4389
- return false ;
4390
- }
4391
-
4392
4385
bool static ProcessMessage (CNode* pfrom, string strCommand, CDataStream& vRecv, int64_t nTimeReceived)
4393
4386
{
4394
4387
RandAddSeedPerfmon ();
@@ -4545,12 +4538,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
4545
4538
{
4546
4539
if (((CNetAddr)pfrom->addr ) == (CNetAddr)addrFrom)
4547
4540
{
4548
- if (SecurityTest (pfrom,true ))
4549
- {
4550
- // Dont store the peer unless it passes the test
4551
- addrman.Add (addrFrom, addrFrom);
4552
- addrman.Good (addrFrom);
4553
- }
4541
+ addrman.Add (addrFrom, addrFrom);
4542
+ addrman.Good (addrFrom);
4554
4543
}
4555
4544
}
4556
4545
@@ -4758,9 +4747,16 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
4758
4747
{
4759
4748
CBlock block;
4760
4749
block.ReadFromDisk ((*mi).second );
4761
- // HALFORD 12-26-2014
4762
- std::string acid = GetCommandNonce (" encrypt" );
4763
- pfrom->PushMessage (" encrypt" , block, acid);
4750
+
4751
+ // TODO: drop legacy "command nonce" removal transition in the next
4752
+ // release after the mandatory version:
4753
+ //
4754
+ if (pfrom->nVersion >= PROTOCOL_VERSION) {
4755
+ pfrom->PushMessage (" encrypt" , block);
4756
+ } else {
4757
+ std::string acid;
4758
+ pfrom->PushMessage (" encrypt" , block, acid);
4759
+ }
4764
4760
4765
4761
// Trigger them to send a getblocks request for the next batch of inventory
4766
4762
if (inv.hash == pfrom->hashContinue )
@@ -4984,8 +4980,16 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
4984
4980
// Response from getblocks, message = block
4985
4981
4986
4982
CBlock block;
4987
- std::string acid = " " ;
4988
- vRecv >> block >> acid;
4983
+ vRecv >> block;
4984
+
4985
+ // TODO: drop legacy "command nonce" removal transition in the next
4986
+ // release after the mandatory version:
4987
+ //
4988
+ if (pfrom->nVersion < PROTOCOL_VERSION) {
4989
+ std::string acid;
4990
+ vRecv >> acid;
4991
+ }
4992
+
4989
4993
uint256 hashBlock = block.GetHash (true );
4990
4994
4991
4995
LogPrintf (" Received block %s; " , hashBlock.ToString ());
@@ -5059,10 +5063,16 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
5059
5063
}
5060
5064
else if (strCommand == " ping" )
5061
5065
{
5062
- std::string acid = " " ;
5063
5066
uint64_t nonce = 0 ;
5067
+ vRecv >> nonce;
5064
5068
5065
- vRecv >> nonce >> acid;
5069
+ // TODO: drop legacy "command nonce" removal transition in the next
5070
+ // release after the mandatory version:
5071
+ //
5072
+ if (pfrom->nVersion < PROTOCOL_VERSION) {
5073
+ std::string acid;
5074
+ vRecv >> acid;
5075
+ }
5066
5076
5067
5077
// Echo the message back with the nonce. This allows for two useful features:
5068
5078
//
@@ -5356,8 +5366,15 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
5356
5366
pto->nPingUsecStart = GetTimeMicros ();
5357
5367
pto->nPingNonceSent = nonce;
5358
5368
5359
- std::string acid = GetCommandNonce (" ping" );
5360
- pto->PushMessage (" ping" , nonce, acid);
5369
+ // TODO: drop legacy "command nonce" removal transition in the next
5370
+ // release after the mandatory version:
5371
+ //
5372
+ if (pto->nVersion >= PROTOCOL_VERSION) {
5373
+ pto->PushMessage (" ping" , nonce);
5374
+ } else {
5375
+ std::string acid;
5376
+ pto->PushMessage (" ping" , nonce, acid);
5377
+ }
5361
5378
}
5362
5379
5363
5380
// Resend wallet transactions that haven't gotten in a block yet
0 commit comments