Skip to content

Commit 834e46e

Browse files
committed
CBlockIndex()::SetNull() method to avoid code repetition
1 parent dd49e92 commit 834e46e

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

src/main.h

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ class CBlockIndex
718718
// (memory only) Sequencial id assigned to distinguish order in which blocks are received.
719719
uint32_t nSequenceId;
720720

721-
CBlockIndex()
721+
void SetNull()
722722
{
723723
phashBlock = NULL;
724724
pprev = NULL;
@@ -740,20 +740,14 @@ class CBlockIndex
740740
nNonce = 0;
741741
}
742742

743+
CBlockIndex()
744+
{
745+
SetNull();
746+
}
747+
743748
CBlockIndex(CBlockHeader& block)
744749
{
745-
phashBlock = NULL;
746-
pprev = NULL;
747-
pskip = NULL;
748-
nHeight = 0;
749-
nFile = 0;
750-
nDataPos = 0;
751-
nUndoPos = 0;
752-
nChainWork = 0;
753-
nTx = 0;
754-
nChainTx = 0;
755-
nStatus = 0;
756-
nSequenceId = 0;
750+
SetNull();
757751

758752
nVersion = block.nVersion;
759753
hashMerkleRoot = block.hashMerkleRoot;

0 commit comments

Comments
 (0)