Skip to content

Commit

Permalink
do not try to mine conflicting name_firstupdates, new seed
Browse files Browse the repository at this point in the history
  • Loading branch information
vinced committed Jul 5, 2011
1 parent e8ba3d6 commit d4f9597
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
3 changes: 1 addition & 2 deletions TODO-namecoin
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
* drop transactions that cannot be accepted because of a name conflict
* simultaneous name_update mines bad block
* name_clean additional review
* name_clean on name_update (but that should have happened anyway?)
* tx can linger in memory on other nodes - move conflict check to CheckTransaction?
* other conflicts: update on expired name, firstupdate on expired name_new
* d7cc9e949d invalid number of args
* blockexplorer
* transfers
* resolver
* IsMine hook to ensure modified clients don't spend namecoins by mistake as regular coins
* listtransactions decode
* auto-send firstupdate after 6 blocks with persistent name/rand
Expand Down
19 changes: 17 additions & 2 deletions src/namecoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class CNamecoinHooks : public CHooks
virtual void AddToWallet(CWalletTx& tx);
virtual bool CheckTransaction(const CTransaction& tx);
virtual bool ConnectInputs(CTxDB& txdb,
map<uint256, CTxIndex>& mapTestPool,
const CTransaction& tx,
vector<CTransaction>& vTxPrev,
vector<CTxIndex>& vTxindex,
Expand Down Expand Up @@ -1330,7 +1331,9 @@ bool IsConflictedTx(CTxDB& txdb, const CTransaction& tx, vector<unsigned char>&
return false;
}

bool CNamecoinHooks::ConnectInputs(CTxDB& txdb, const CTransaction& tx,
bool CNamecoinHooks::ConnectInputs(CTxDB& txdb,
map<uint256, CTxIndex>& mapTestPool,
const CTransaction& tx,
vector<CTransaction>& vTxPrev,
vector<CTxIndex>& vTxindex,
CBlockIndex* pindexBlock,
Expand Down Expand Up @@ -1404,6 +1407,18 @@ bool CNamecoinHooks::ConnectInputs(CTxDB& txdb, const CTransaction& tx,
nDepth = CheckTransactionAtRelativeDepth(pindexBlock, vTxindex[nInput], EXPIRATION_DEPTH);
if (nDepth == -1)
return error("ConnectInputsHook() : name_firstupdate cannot be mined if name_new is not already in chain and unexpired");
// Check that no other pending txs on this name are already in the block to be mined
set<uint256>& setPending = mapNamePending[vvchArgs[0]];
foreach (const PAIRTYPE(uint256, const CTxIndex&)& s, mapTestPool)
{
if (setPending.count(s.first))
{
printf("ConnectInputsHook() : will not mine %s because it clashes with %s",
tx.GetHash().GetHex().c_str(),
s.first.GetHex().c_str());
return false;
}
}
}
break;
case OP_NAME_UPDATE:
Expand Down Expand Up @@ -1644,7 +1659,7 @@ unsigned short GetDefaultPort()
return fTestNet ? htons(18334) : htons(8334);
}

unsigned int pnSeed[] = { 0x58cea445, NULL };
unsigned int pnSeed[] = { 0x58cea445, 0x2b562f4e, NULL };
const char *strDNSSeed[] = { NULL };

string GetDefaultDataDirSuffix() {
Expand Down

0 comments on commit d4f9597

Please sign in to comment.