mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Safety check in CInstantSend::SyncTransaction (#1412)
This commit is contained in:
parent
5758ae1bfc
commit
68e1a8c790
@ -786,7 +786,17 @@ void CInstantSend::SyncTransaction(const CTransaction& tx, const CBlock* pblock)
|
||||
uint256 txHash = tx.GetHash();
|
||||
|
||||
// When tx is 0-confirmed or conflicted, pblock is NULL and nHeightNew should be set to -1
|
||||
CBlockIndex* pblockindex = pblock ? mapBlockIndex[pblock->GetHash()] : NULL;
|
||||
CBlockIndex* pblockindex = NULL;
|
||||
if(pblock) {
|
||||
uint256 blockHash = pblock->GetHash();
|
||||
BlockMap::iterator mi = mapBlockIndex.find(blockHash);
|
||||
if(mi == mapBlockIndex.end() || !mi->second) {
|
||||
// shouldn't happen
|
||||
LogPrint("instantsend", "CTxLockRequest::SyncTransaction -- Failed to find block %s\n", blockHash.ToString());
|
||||
return;
|
||||
}
|
||||
pblockindex = mi->second;
|
||||
}
|
||||
int nHeightNew = pblockindex ? pblockindex->nHeight : -1;
|
||||
|
||||
LogPrint("instantsend", "CInstantSend::SyncTransaction -- txid=%s nHeightNew=%d\n", txHash.ToString(), nHeightNew);
|
||||
|
Loading…
Reference in New Issue
Block a user