@@ -43,11 +43,9 @@ extern std::string NodeAddress(CNode* pfrom);
43
43
extern bool WalletOutOfSync ();
44
44
bool AdvertiseBeacon (std::string &sOutPrivKey , std::string &sOutPubKey , std::string &sError , std::string &sMessage );
45
45
extern void CleanInboundConnections (bool bClearAll);
46
- bool RequestSupermajorityNeuralData ();
47
46
extern bool AskForOutstandingBlocks (uint256 hashStart);
48
47
extern void ResetTimerMain (std::string timer_name);
49
48
extern void IncrementCurrentNeuralNetworkSupermajority (const NN::QuorumHash& quorum_hash, std::string GRCAddress, double distance);
50
- extern double ExtractMagnitudeFromExplainMagnitude ();
51
49
extern void GridcoinServices ();
52
50
extern bool StrLessThanReferenceHash (std::string rh);
53
51
extern bool IsContract (CBlockIndex* pIndex);
@@ -57,9 +55,6 @@ extern void IncrementVersionCount(const std::string& Version);
57
55
extern bool LoadAdminMessages (bool bFullTableScan,std::string& out_errors);
58
56
extern std::string GetCurrentNeuralNetworkSupermajorityHash (double & out_popularity);
59
57
60
- bool AsyncNeuralRequest (std::string command_name,std::string cpid,int NodeLimit);
61
- extern bool FullSyncWithDPORNodes ();
62
-
63
58
extern bool GetEarliestStakeTime (std::string grcaddress, std::string cpid);
64
59
extern double GetTotalBalance ();
65
60
extern std::string PubKeyToAddress (const CScript& scriptPubKey);
@@ -181,7 +176,6 @@ std::string msMiningErrors7;
181
176
std::string msMiningErrors8;
182
177
std::string msMiningErrorsIncluded;
183
178
std::string msMiningErrorsExcluded;
184
- std::string msNeuralResponse;
185
179
std::string msHDDSerial;
186
180
// When syncing, we grandfather block rejection rules up to this block, as rules became stricter over time and fields changed
187
181
@@ -227,28 +221,6 @@ bool TimerMain(std::string timer_name, int max_ms)
227
221
return false ;
228
222
}
229
223
230
- bool FullSyncWithDPORNodes ()
231
- {
232
- if (!NN::GetInstance ()->IsEnabled ())
233
- return false ;
234
- // 3-30-2016 : First try to get the master database from another neural network node if these conditions occur:
235
- // The foreign node is fully synced. The foreign nodes quorum hash matches the supermajority hash. My hash != supermajority hash.
236
- double dCurrentPopularity = 0 ;
237
- std::string sCurrentNeuralSupermajorityHash = GetCurrentNeuralNetworkSupermajorityHash (dCurrentPopularity);
238
- std::string sMyNeuralHash = NN::GetInstance ()->GetNeuralHash ();
239
- if (!sMyNeuralHash .empty () && sMyNeuralHash != sCurrentNeuralSupermajorityHash )
240
- {
241
- bool bNodeOnline = RequestSupermajorityNeuralData ();
242
- if (bNodeOnline)
243
- return false ; // Async call to another node will continue after the node responds.
244
- }
245
-
246
- std::string errors1;
247
- LoadAdminMessages (false ,errors1);
248
- NN::GetInstance ()->SynchronizeDPOR (GetConsensusBeaconList ());
249
- return true ;
250
- }
251
-
252
224
double GetEstimatedNetworkWeight (unsigned int nPoSInterval)
253
225
{
254
226
// The number of stakes to include in the average has been reduced to 40 (default) from 72. 72 stakes represented 1.8 hours at
@@ -3620,57 +3592,6 @@ void GridcoinServices()
3620
3592
LogPrintf (" Daily backup results: Wallet -> %s Config -> %s" , (bWalletBackupResults ? " true" : " false" ), (bConfigBackupResults ? " true" : " false" ));
3621
3593
}
3622
3594
3623
- if (TimerMain (" MyNeuralMagnitudeReport" ,30 ))
3624
- {
3625
- try
3626
- {
3627
- std::string primary_cpid = NN::GetPrimaryCpid ();
3628
-
3629
- if (msNeuralResponse.length () < 25 && IsResearcher (primary_cpid))
3630
- {
3631
- AsyncNeuralRequest (" explainmag" , primary_cpid, 5 );
3632
- if (fDebug3 ) LogPrintf (" Async explainmag sent for %s." , primary_cpid);
3633
- }
3634
- if (fDebug3 ) LogPrintf (" MR Complete" );
3635
- }
3636
- catch (std::exception &e)
3637
- {
3638
- LogPrintf (" Error in MyNeuralMagnitudeReport1." );
3639
- }
3640
- catch (...)
3641
- {
3642
- LogPrintf (" Error in MyNeuralMagnitudeReport." );
3643
- }
3644
- }
3645
-
3646
- // Every N blocks as a Synchronized TEAM:
3647
- if ((nBestHeight % 30 ) == 0 )
3648
- {
3649
- // Sync RAC with neural network IF superblock is over 24 hours Old, Or if we have No superblock (in case of the latter, age will be 45 years old)
3650
- // Note that nodes will NOT accept superblocks without a supermajority hash, so the last block will not be in memory unless it is a good superblock.
3651
- // Let's start syncing the neural network as soon as the LAST superblock is over 12 hours old.
3652
- // Also, lets do this as a TEAM exactly every 30 blocks (~30 minutes) to try to reach an EXACT consensus every half hour:
3653
- // For effeciency, the network sleeps for 20 hours after a good superblock is accepted
3654
- if (NN::Tally::SuperblockNeeded () && IsNeuralNodeParticipant (DefaultWalletAddress (), GetAdjustedTime ()))
3655
- {
3656
- if (fDebug3 ) LogPrintf (" FSWDPOR " );
3657
- FullSyncWithDPORNodes ();
3658
- }
3659
- }
3660
-
3661
- if (( (nBestHeight-10 ) % 30 ) == 0 )
3662
- {
3663
- // 10 Blocks after the network started syncing the neural network as a team, ask the neural network to come to a quorum
3664
- if (NN::Tally::SuperblockNeeded () && IsNeuralNodeParticipant (DefaultWalletAddress (), GetAdjustedTime ()))
3665
- {
3666
- // First verify my node has a synced contract
3667
- if (NN::GetInstance ()->GetSuperblockContract ().WellFormed ())
3668
- {
3669
- AsyncNeuralRequest (" quorum" ," gridcoin" ,25 );
3670
- }
3671
- }
3672
- }
3673
-
3674
3595
/* Do this only for users with valid CPID */
3675
3596
if (TimerMain (" send_beacon" , 180 )) {
3676
3597
if (const NN::CpidOption cpid = NN::Researcher::Get ()->Id ().TryCpid ()) {
@@ -3690,9 +3611,6 @@ void GridcoinServices()
3690
3611
}
3691
3612
}
3692
3613
}
3693
-
3694
- if (TimerMain (" gather_cpids" ,480 ))
3695
- msNeuralResponse.clear ();
3696
3614
}
3697
3615
3698
3616
bool AskForOutstandingBlocks (uint256 hashStart)
@@ -4521,47 +4439,6 @@ std::string NodeAddress(CNode* pfrom)
4521
4439
return ip;
4522
4440
}
4523
4441
4524
- double ExtractMagnitudeFromExplainMagnitude ()
4525
- {
4526
- if (msNeuralResponse.empty ()) return 0 ;
4527
- try
4528
- {
4529
- std::vector<std::string> vMag = split (msNeuralResponse.c_str ()," <ROW>" );
4530
- for (unsigned int i = 0 ; i < vMag.size (); i++)
4531
- {
4532
- if (Contains (vMag[i]," Total Mag:" ))
4533
- {
4534
- std::vector<std::string> vMyMag = split (vMag[i].c_str ()," :" );
4535
- if (vMyMag.size () > 0 )
4536
- {
4537
- std::string sSubMag = vMyMag[1 ];
4538
- boost::replace_all (sSubMag , " " , " " );
4539
- double dMag = RoundFromString (" 0" +sSubMag ,0 );
4540
- return dMag;
4541
- }
4542
- }
4543
- }
4544
- return 0 ;
4545
- }
4546
- catch (...)
4547
- {
4548
- return 0 ;
4549
- }
4550
- return 0 ;
4551
- }
4552
-
4553
- bool VerifyExplainMagnitudeResponse ()
4554
- {
4555
- if (msNeuralResponse.empty ())
4556
- return false ;
4557
-
4558
- double dMag = ExtractMagnitudeFromExplainMagnitude ();
4559
- if (dMag==0 )
4560
- msNeuralResponse.clear ();
4561
-
4562
- return dMag != 0 ;
4563
- }
4564
-
4565
4442
bool SecurityTest (CNode* pfrom, bool acid_test)
4566
4443
{
4567
4444
if (pfrom->nStartingHeight > (nBestHeight*.5 ) && acid_test) return true ;
@@ -4605,13 +4482,20 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
4605
4482
CAddress addrMe;
4606
4483
CAddress addrFrom;
4607
4484
uint64_t nNonce = 1 ;
4608
- std::string acid = " " ;
4609
- vRecv >> pfrom->nVersion >> pfrom->boinchashnonce >> pfrom->boinchashpw >> pfrom->cpid >> pfrom->enccpid >> acid >> pfrom->nServices >> nTime >> addrMe;
4485
+ std::string legacy_dummy;
4486
+
4487
+ vRecv >> pfrom->nVersion
4488
+ >> legacy_dummy // pfrom->boinchashnonce
4489
+ >> legacy_dummy // pfrom->boinchashpw
4490
+ >> legacy_dummy // pfrom->cpid
4491
+ >> legacy_dummy // pfrom->enccpid
4492
+ >> legacy_dummy // acid
4493
+ >> pfrom->nServices
4494
+ >> nTime
4495
+ >> addrMe;
4610
4496
4611
4497
if (fDebug10 )
4612
- LogPrintf (" received aries version %i boinchashnonce %s boinchashpw %s cpid %s enccpid %s acid %s ..."
4613
- ,pfrom->nVersion , pfrom->boinchashnonce , pfrom->boinchashpw
4614
- ,pfrom->cpid .c_str (), pfrom->enccpid , acid);
4498
+ LogPrintf (" received aries version %i ..." , pfrom->nVersion );
4615
4499
4616
4500
int64_t timedrift = std::abs (GetAdjustedTime () - nTime);
4617
4501
@@ -4669,7 +4553,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
4669
4553
// 12-5-2015 - Append Trust fields
4670
4554
pfrom->nTrust = 0 ;
4671
4555
4672
- if (!vRecv.empty ()) vRecv >> pfrom->sGRCAddress ;
4556
+ if (!vRecv.empty ()) vRecv >> legacy_dummy; // pfrom->sGRCAddress;
4673
4557
4674
4558
4675
4559
// Allow newbies to connect easily with 0 blocks
@@ -5267,33 +5151,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
5267
5151
if (!tracker.IsNull ())
5268
5152
tracker.fn (tracker.param1 , vRecv);
5269
5153
}
5270
- else if (strCommand == " neural" )
5271
- {
5272
- std::string neural_request = " " ;
5273
- std::string neural_request_id = " " ;
5274
- vRecv >> neural_request >> neural_request_id; // foreign node issued neural request with request ID:
5275
- std::string neural_response = " generic_response" ;
5276
-
5277
- if (neural_request==" neural_data" )
5278
- {
5279
- pfrom->PushMessage (" ndata_nresp" , NN::GetInstance ()->GetNeuralContract ());
5280
- }
5281
- else if (neural_request==" neural_hash" )
5282
- {
5283
- pfrom->PushMessage (" hash_nresp" , NN::GetInstance ()->GetNeuralHash ());
5284
- }
5285
- else if (neural_request==" explainmag" )
5286
- {
5287
- pfrom->PushMessage (
5288
- " expmag_nresp" ,
5289
- NN::GetInstance ()->ExplainMagnitude (neural_request_id));
5290
- }
5291
- else if (neural_request==" quorum" )
5292
- {
5293
- // 7-12-2015 Resolve discrepencies in w nodes to speak to each other
5294
- pfrom->PushMessage (" quorum_nresp" , NN::GetInstance ()->GetNeuralContract ());
5295
- }
5296
- }
5297
5154
else if (strCommand == " ping" )
5298
5155
{
5299
5156
std::string acid = " " ;
@@ -5371,41 +5228,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
5371
5228
pfrom->nPingNonceSent = 0 ;
5372
5229
}
5373
5230
}
5374
- else if (strCommand == " hash_nresp" )
5375
- {
5376
- std::string neural_response = " " ;
5377
- vRecv >> neural_response;
5378
- // if (pfrom->nNeuralRequestSent != 0)
5379
- // nNeuralNonce must match request ID
5380
- pfrom->NeuralHash = neural_response;
5381
- if (fDebug10 ) LogPrintf (" hash_Neural Response %s " ,neural_response);
5382
- }
5383
- else if (strCommand == " expmag_nresp" )
5384
- {
5385
- std::string neural_response = " " ;
5386
- vRecv >> neural_response;
5387
- if (neural_response.length () > 10 )
5388
- {
5389
- msNeuralResponse=neural_response;
5390
- // If invalid, try again 10-20-2015
5391
- VerifyExplainMagnitudeResponse ();
5392
- }
5393
- if (fDebug10 ) LogPrintf (" expmag_Neural Response %s " ,neural_response);
5394
- }
5395
- else if (strCommand == " quorum_nresp" )
5396
- {
5397
- std::string neural_contract = " " ;
5398
- vRecv >> neural_contract;
5399
- if (fDebug && neural_contract.length () > 100 ) LogPrintf (" Quorum contract received %s" ,neural_contract.substr (0 ,80 ));
5400
- }
5401
- else if (strCommand == " ndata_nresp" )
5402
- {
5403
- std::string neural_contract;
5404
- vRecv >> neural_contract;
5405
- if (fDebug3 && neural_contract.length () > 100 ) LogPrintf (" Quorum contract received %s" ,neural_contract.substr (0 ,80 ));
5406
- if (neural_contract.length () > 10 )
5407
- FullSyncWithDPORNodes ();
5408
- }
5409
5231
else if (strCommand == " alert" )
5410
5232
{
5411
5233
CAlert alert;
0 commit comments