@@ -360,7 +360,7 @@ static bool CommonDataCheck(const CDomainEntry& entry, const vchCharString& vvch
360
360
return true ;
361
361
}
362
362
363
- bool CheckNewDomainEntryTxInputs (const CDomainEntry& entry, const CScript& scriptOp, const vchCharString& vvchOpParameters,
363
+ bool CheckNewDomainEntryTxInputs (const CDomainEntry& entry, const CScript& scriptOp, const vchCharString& vvchOpParameters, const uint256& txHash,
364
364
std::string& errorMessage, bool fJustCheck )
365
365
{
366
366
if (!CommonDataCheck (entry, vvchOpParameters, errorMessage))
@@ -372,8 +372,14 @@ bool CheckNewDomainEntryTxInputs(const CDomainEntry& entry, const CScript& scrip
372
372
CDomainEntry getDomainEntry;
373
373
if (GetDomainEntry (entry.vchFullObjectPath (), getDomainEntry))
374
374
{
375
- errorMessage = " CheckNewDomainEntryTxInputs: - The entry " + getDomainEntry.GetFullObjectPath () + " already exists. Add new entry failed!" ;
376
- return error (errorMessage.c_str ());
375
+ if (entry.txHash != txHash) {
376
+ errorMessage = " CheckNewDomainEntryTxInputs: - The entry " + getDomainEntry.GetFullObjectPath () + " already exists. Add new entry failed!" ;
377
+ return error (errorMessage.c_str ());
378
+ }
379
+ else {
380
+ LogPrintf (" %s -- Already have entry %s in local database. Skipping add entry step.\n " , __func__, entry.GetFullObjectPath ());
381
+ return true ;
382
+ }
377
383
}
378
384
379
385
if (!pDomainEntryDB)
@@ -449,7 +455,7 @@ bool CheckDeleteDomainEntryTxInputs(const CDomainEntry& entry, const CScript& sc
449
455
return FlushLevelDB ();
450
456
}
451
457
452
- bool CheckUpdateDomainEntryTxInputs (const CDomainEntry& entry, const CScript& scriptOp, const vchCharString& vvchOpParameters,
458
+ bool CheckUpdateDomainEntryTxInputs (const CDomainEntry& entry, const CScript& scriptOp, const vchCharString& vvchOpParameters, const uint256& txHash,
453
459
std::string& errorMessage, bool fJustCheck )
454
460
{
455
461
// if exists, check for owner's signature
@@ -462,8 +468,14 @@ bool CheckUpdateDomainEntryTxInputs(const CDomainEntry& entry, const CScript& sc
462
468
CDomainEntry prevDomainEntry;
463
469
if (!GetDomainEntry (entry.vchFullObjectPath (), prevDomainEntry))
464
470
{
465
- errorMessage = " CheckUpdateDomainEntryTxInputs: - Can not find " + prevDomainEntry.GetFullObjectPath () + " entry; this update operation failed!" ;
466
- return error (errorMessage.c_str ());
471
+ if (entry.txHash != txHash) {
472
+ errorMessage = " CheckUpdateDomainEntryTxInputs: - Can not find " + prevDomainEntry.GetFullObjectPath () + " entry; this update operation failed!" ;
473
+ return error (errorMessage.c_str ());
474
+ }
475
+ else {
476
+ LogPrintf (" %s -- Already have entry %s in local database. Skipping update entry step.\n " , __func__, entry.GetFullObjectPath ());
477
+ return true ;
478
+ }
467
479
}
468
480
469
481
CTxDestination bdapDest;
@@ -577,11 +589,11 @@ bool CheckDomainEntryTx(const CTransactionRef& tx, const CScript& scriptOp, cons
577
589
entry.nHeight = nHeight;
578
590
}
579
591
if (strOperationType == " bdap_new_account" )
580
- return CheckNewDomainEntryTxInputs (entry, scriptOp, vvchArgs, errorMessage, fJustCheck );
592
+ return CheckNewDomainEntryTxInputs (entry, scriptOp, vvchArgs, tx-> GetHash (), errorMessage, fJustCheck );
581
593
else if (strOperationType == " bdap_delete_account" )
582
594
return CheckDeleteDomainEntryTxInputs (entry, scriptOp, vvchArgs, errorMessage, fJustCheck );
583
595
else if (strOperationType == " bdap_update_account" )
584
- return CheckUpdateDomainEntryTxInputs (entry, scriptOp, vvchArgs, errorMessage, fJustCheck );
596
+ return CheckUpdateDomainEntryTxInputs (entry, scriptOp, vvchArgs, tx-> GetHash (), errorMessage, fJustCheck );
585
597
else if (strOperationType == " bdap_move_account" )
586
598
return CheckMoveDomainEntryTxInputs (entry, scriptOp, vvchArgs, errorMessage, fJustCheck );
587
599
else if (strOperationType == " bdap_revoke_account" )
0 commit comments