File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ class CBlock : public CBlockHeader
139139 {
140140 READWRITEAS (CBlockHeader, obj);
141141 READWRITE (obj.vtx );
142- if (obj.vtx .size () > 1 && obj.vtx [1 ]->IsCoinStake ())
142+ if (obj.vtx .size () >= 2 && obj.vtx [1 ]->IsCoinStake ())
143143 READWRITE (obj.vchBlockSig );
144144 }
145145
@@ -166,7 +166,7 @@ class CBlock : public CBlockHeader
166166 // peercoin: two types of block: proof-of-work or proof-of-stake
167167 /* bool IsProofOfStake() const
168168 {
169- return (vtx.size() > 1 && vtx[1]->IsCoinStake());
169+ return (vtx.size() >= 2 && vtx[1]->IsCoinStake());
170170 }
171171
172172 bool IsProofOfWork() const
Original file line number Diff line number Diff line change @@ -340,7 +340,7 @@ class CTransaction
340340 bool IsCoinStake () const
341341 {
342342 // peercoin: the coin stake transaction is marked with the first output empty
343- return (vin.size () > 0 && ( !vin[0 ].prevout .IsNull () ) && vout.size () >= 2 && vout[0 ].IsEmpty ());
343+ return (! vin.empty () && !vin[0 ].prevout .IsNull () && vout.size () >= 2 && vout[0 ].IsEmpty ());
344344 }
345345
346346 friend bool operator ==(const CTransaction& a, const CTransaction& b)
@@ -406,7 +406,7 @@ struct CMutableTransaction
406406 bool IsCoinStake () const
407407 {
408408 // peercoin: the coin stake transaction is marked with the first output empty
409- return (vin.size () > 0 && ( !vin[0 ].prevout .IsNull () ) && vout.size () >= 2 && vout[0 ].IsEmpty ());
409+ return (! vin.empty () && !vin[0 ].prevout .IsNull () && vout.size () >= 2 && vout[0 ].IsEmpty ());
410410 }
411411
412412 friend bool operator ==(const CMutableTransaction& a, const CMutableTransaction& b)
You can’t perform that action at this time.
0 commit comments