aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-04-16 14:56:45 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2012-04-17 20:03:42 +0200
commit6b6aaa1698838278a547f16a15e635bd58ec867d (patch)
tree62a79e33a866c2a92f548cecb6148c7339f8beaf /src/main.h
parentccd65d426156c3d5b7a8f1123210decd1f06fe42 (diff)
Further reduce header dependencies
This commit removes the dependency of serialize.h on PROTOCOL_VERSION, and makes this parameter required instead of implicit. This is much saner, as it makes the places where changing a version number can have an influence obvious.
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main.h b/src/main.h
index b6bce014ec..bcd62080d5 100644
--- a/src/main.h
+++ b/src/main.h
@@ -7,9 +7,7 @@
#include "bignum.h"
#include "net.h"
-#include "key.h"
#include "script.h"
-#include "version.h"
#ifdef WIN32
#include <io.h> /* for _commit */
@@ -545,7 +543,7 @@ public:
// Base fee is either MIN_TX_FEE or MIN_RELAY_TX_FEE
int64 nBaseFee = (mode == GMF_RELAY) ? MIN_RELAY_TX_FEE : MIN_TX_FEE;
- unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK);
+ unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION);
unsigned int nNewBlockSize = nBlockSize + nBytes;
int64 nMinFee = (1 + (int64)nBytes / 1000) * nBaseFee;
@@ -590,7 +588,7 @@ public:
bool ReadFromDisk(CDiskTxPos pos, FILE** pfileRet=NULL)
{
- CAutoFile filein = OpenBlockFile(pos.nFile, 0, pfileRet ? "rb+" : "rb");
+ CAutoFile filein = CAutoFile(OpenBlockFile(pos.nFile, 0, pfileRet ? "rb+" : "rb"), SER_DISK, CLIENT_VERSION);
if (!filein)
return error("CTransaction::ReadFromDisk() : OpenBlockFile failed");
@@ -941,7 +939,7 @@ public:
bool WriteToDisk(unsigned int& nFileRet, unsigned int& nBlockPosRet)
{
// Open history file to append
- CAutoFile fileout = AppendBlockFile(nFileRet);
+ CAutoFile fileout = CAutoFile(AppendBlockFile(nFileRet), SER_DISK, CLIENT_VERSION);
if (!fileout)
return error("CBlock::WriteToDisk() : AppendBlockFile failed");
@@ -974,7 +972,7 @@ public:
SetNull();
// Open history file to read
- CAutoFile filein = OpenBlockFile(nFile, nBlockPos, "rb");
+ CAutoFile filein = CAutoFile(OpenBlockFile(nFile, nBlockPos, "rb"), SER_DISK, CLIENT_VERSION);
if (!filein)
return error("CBlock::ReadFromDisk() : OpenBlockFile failed");
if (!fReadTransactions)
@@ -1135,7 +1133,7 @@ public:
bool EraseBlockFromDisk()
{
// Open history file
- CAutoFile fileout = OpenBlockFile(nFile, nBlockPos, "rb+");
+ CAutoFile fileout = CAutoFile(OpenBlockFile(nFile, nBlockPos, "rb+"), SER_DISK, CLIENT_VERSION);
if (!fileout)
return false;
@@ -1595,7 +1593,7 @@ public:
return error("CAlert::CheckSignature() : verify signature failed");
// Now unserialize the data
- CDataStream sMsg(vchMsg);
+ CDataStream sMsg(vchMsg, SER_NETWORK, PROTOCOL_VERSION);
sMsg >> *(CUnsignedAlert*)this;
return true;
}