return false;
//// issue here: it doesn't know the version
- unsigned int nTxPos = pindex->nBlockPos + ::GetSerializeSize(CBlock(), SER_DISK) - 1 + GetSizeOfCompactSize(vtx.size());
+ unsigned int nTxPos = pindex->nBlockPos + ::GetSerializeSize(CBlock(), SER_DISK) - (2 * GetSizeOfCompactSize(0)) + GetSizeOfCompactSize(vtx.size());
map<uint256, CTxIndex> mapQueuedChanges;
int64 nFees = 0;
unsigned int nBits;
unsigned int nNonce;
- // ppcoin: block signature (not considered part of header)
- // signed by coin base txout[0]'s owner
- std::vector<unsigned char> vchBlockSig;
-
// network and disk
std::vector<CTransaction> vtx;
+ // ppcoin: block signature - signed by coin base txout[0]'s owner
+ std::vector<unsigned char> vchBlockSig;
+
// memory only
mutable std::vector<uint256> vMerkleTree;
READWRITE(nBits);
READWRITE(nNonce);
- // ConnectBlock depends on vtx being last so it can calculate offset
+ // ConnectBlock depends on vtx following header to generate CDiskTxPos
if (!(nType & (SER_GETHASH|SER_BLOCKHEADERONLY)))
{
- READWRITE(vchBlockSig);
READWRITE(vtx);
+ READWRITE(vchBlockSig);
}
else if (fRead)
{
- const_cast<CBlock*>(this)->vchBlockSig.clear();
const_cast<CBlock*>(this)->vtx.clear();
+ const_cast<CBlock*>(this)->vchBlockSig.clear();
}
)
nTime = 0;
nBits = 0;
nNonce = 0;
- vchBlockSig.clear();
vtx.clear();
+ vchBlockSig.clear();
vMerkleTree.clear();
nDoS = 0;
}
void print() const
{
- printf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vchBlockSig=%s, vtx=%d)\n",
+ printf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%d, vchBlockSig=%s)\n",
GetHash().ToString().substr(0,20).c_str(),
nVersion,
hashPrevBlock.ToString().substr(0,20).c_str(),
hashMerkleRoot.ToString().substr(0,10).c_str(),
nTime, nBits, nNonce,
- HexStr(vchBlockSig.begin(), vchBlockSig.end()).c_str(),
- vtx.size());
+ vtx.size(),
+ HexStr(vchBlockSig.begin(), vchBlockSig.end()).c_str());
for (int i = 0; i < vtx.size(); i++)
{
printf(" ");