Skip to content

Commit

Permalink
Merge pull request #96 from BlockMechanic/segwit
Browse files Browse the repository at this point in the history
Segwit
  • Loading branch information
BlockMechanic authored Aug 19, 2022
2 parents 2a53153 + 6440b78 commit 862d956
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 10 additions & 8 deletions src/systemnode/systemnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ int64_t CSystemnode::GetLastPaid() const
bool CSystemnode::GetRecentPaymentBlocks(std::vector<const CBlockIndex*>& vPaymentBlocks, bool limitMostRecent) const
{
vPaymentBlocks.clear();

int nMinimumValidBlockHeight = ::ChainActive().Height() - Params().ValidStakePointerDuration();
if (nMinimumValidBlockHeight < 1)
nMinimumValidBlockHeight = 1;
Expand All @@ -285,14 +284,17 @@ bool CSystemnode::GetRecentPaymentBlocks(std::vector<const CBlockIndex*>& vPayme
CBlock block;
if (!ReadBlockFromDisk(block, pindex, Params().GetConsensus()))
continue;
CTxOutAsset out = (block.vtx[0]->nVersion >= TX_ELE_VERSION ? block.vtx[0]->vpout[2] : block.vtx[0]->vout[2]);

int m = (block.vtx[0]->nVersion >= TX_ELE_VERSION ? block.vtx[0]->vpout.size() : block.vtx[0]->vout.size());

if (m > 2 && out.scriptPubKey == snpayee) {
vPaymentBlocks.emplace_back(pindex);
fBlockFound = true;
if (limitMostRecent)
return fBlockFound;

if (m > 2) {
CTxOutAsset out = (block.vtx[0]->nVersion >= TX_ELE_VERSION ? block.vtx[0]->vpout[2] : block.vtx[0]->vout[2]);
if (out.scriptPubKey == snpayee){
vPaymentBlocks.emplace_back(pindex);
fBlockFound = true;
if (limitMostRecent)
return fBlockFound;
}
}
pindex = ::ChainActive().Next(pindex);
}
Expand Down
4 changes: 2 additions & 2 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1956,8 +1956,8 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI
// restore inputs
if (i > 0 && !tx.IsCoinStake()) { // not coinbases
int nOffSet = 1;
if (pindex->nHeight >= Params().PoSStartHeight())
nOffSet = 2;
//if (pindex->nHeight >= Params().PoSStartHeight())
// nOffSet = 2;
CTxUndo &txundo = blockUndo.vtxundo[i-nOffSet];
if (txundo.vprevout.size() != tx.vin.size()) {
error("DisconnectBlock(): transaction and undo data inconsistent %d vs %d i=%d, nOffSet=%d", txundo.vprevout.size(), tx.vin.size(), i, nOffSet);
Expand Down

0 comments on commit 862d956

Please sign in to comment.