| 429 | } |
| 430 | |
| 431 | void CleanTransactionLocksList() { |
| 432 | if (chainActive.Tip() == NULL) return; |
| 433 | |
| 434 | std::map<uint256, CTransactionLock>::iterator it = mapTxLocks.begin(); |
| 435 | |
| 436 | while (it != mapTxLocks.end()) { |
| 437 | if (GetTime() > it->second.nExpiration) { //keep them for an hour |
| 438 | LogPrintf("Removing old transaction lock %s\n", it->second.txHash.ToString().c_str()); |
| 439 | |
| 440 | if (mapTxLockReq.count(it->second.txHash)) { |
| 441 | CTransaction& tx = mapTxLockReq[it->second.txHash]; |
| 442 | |
| 443 | for (const CTxIn& in : tx.vin) |
| 444 | mapLockedInputs.erase(in.prevout); |
| 445 | |
| 446 | mapTxLockReq.erase(it->second.txHash); |
| 447 | mapTxLockReqRejected.erase(it->second.txHash); |
| 448 | |
| 449 | for (CConsensusVote& v : it->second.vecConsensusVotes) |
| 450 | mapTxLockVote.erase(v.GetHash()); |
| 451 | } |
| 452 | |
| 453 | mapTxLocks.erase(it++); |
| 454 | } else { |
| 455 | it++; |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | } |
| 460 | |
| 461 | uint256 CConsensusVote::GetHash() const { |
| 462 | return vinMasternode.prevout.hash + vinMasternode.prevout.n + txHash; |