@ -64,12 +64,16 @@ public:
CKeyPool ( const CPubKey & vchPubKeyIn ) ;
CKeyPool ( const CPubKey & vchPubKeyIn ) ;
IMPLEMENT_SERIALIZE
IMPLEMENT_SERIALIZE
(
template < typename T , typename Stream , typename Operation >
inline static size_t SerializationOp ( T thisPtr , Stream & s , Operation ser_action , int nType , int nVersion ) {
size_t nSerSize = 0 ;
if ( ! ( nType & SER_GETHASH ) )
if ( ! ( nType & SER_GETHASH ) )
READWRITE ( nVersion ) ;
READWRITE ( nVersion ) ;
READWRITE ( nTime ) ;
READWRITE ( thisPtr - > nTime ) ;
READWRITE ( vchPubKey ) ;
READWRITE ( thisPtr - > vchPubKey ) ;
)
return nSerSize ;
}
} ;
} ;
/** Address book data */
/** Address book data */
@ -489,16 +493,20 @@ public:
fMerkleVerified = false ;
fMerkleVerified = false ;
}
}
IMPLEMENT_SERIALIZE
IMPLEMENT_SERIALIZE
(
nSerSize + = SerReadWrite ( s , * ( CTransaction * ) this , nType , nVersion , ser_action ) ;
nVersion = this - > nVersion ;
READWRITE ( hashBlock ) ;
READWRITE ( vMerkleBranch ) ;
READWRITE ( nIndex ) ;
)
template < typename T , typename Stream , typename Operation >
inline static size_t SerializationOp ( T thisPtr , Stream & s , Operation ser_action , int nType , int nVersion ) {
size_t nSerSize = 0 ;
nSerSize + = SerReadWrite ( s , * ( CTransaction * ) thisPtr , nType , nVersion , ser_action ) ;
nVersion = thisPtr - > nVersion ;
READWRITE ( thisPtr - > hashBlock ) ;
READWRITE ( thisPtr - > vMerkleBranch ) ;
READWRITE ( thisPtr - > nIndex ) ;
return nSerSize ;
}
int SetMerkleBranch ( const CBlock * pblock = NULL ) ;
int SetMerkleBranch ( const CBlock * pblock = NULL ) ;
@ -513,7 +521,6 @@ public:
bool AcceptToMemoryPool ( bool fLimitFree = true , bool fRejectInsaneFee = true ) ;
bool AcceptToMemoryPool ( bool fLimitFree = true , bool fRejectInsaneFee = true ) ;
} ;
} ;
/** A transaction with a bunch of additional info that only the owner cares about.
/** A transaction with a bunch of additional info that only the owner cares about.
* It includes any unrecorded transactions needed to link it back to the block chain .
* It includes any unrecorded transactions needed to link it back to the block chain .
*/
*/
@ -604,8 +611,13 @@ public:
}
}
IMPLEMENT_SERIALIZE
IMPLEMENT_SERIALIZE
(
CWalletTx * pthis = const_cast < CWalletTx * > ( this ) ;
template < typename T , typename Stream , typename Operation >
inline static size_t SerializationOp ( T thisPtr , Stream & s , Operation ser_action , int nType , int nVersion ) {
size_t nSerSize = 0 ;
bool fRead = boost : : is_same < Operation , CSerActionUnserialize > ( ) ;
CWalletTx * pthis = const_cast < CWalletTx * > ( thisPtr ) ;
if ( fRead )
if ( fRead )
pthis - > Init ( NULL ) ;
pthis - > Init ( NULL ) ;
char fSpent = false ;
char fSpent = false ;
@ -616,18 +628,18 @@ public:
WriteOrderPos ( pthis - > nOrderPos , pthis - > mapValue ) ;
WriteOrderPos ( pthis - > nOrderPos , pthis - > mapValue ) ;
if ( nTimeSmart )
if ( thisPtr - > nTimeSmart )
pthis - > mapValue [ " timesmart " ] = strprintf ( " %u " , nTimeSmart ) ;
pthis - > mapValue [ " timesmart " ] = strprintf ( " %u " , thisPtr - > nTimeSmart ) ;
}
}
nSerSize + = SerReadWrite ( s , * ( CMerkleTx * ) this , nType , nVersion , ser_action ) ;
nSerSize + = SerReadWrite ( s , * ( CMerkleTx * ) thisPtr , nType , nVersion , ser_action ) ;
std : : vector < CMerkleTx > vUnused ; // Used to be vtxPrev
std : : vector < CMerkleTx > vUnused ; // Used to be vtxPrev
READWRITE ( vUnused ) ;
READWRITE ( vUnused ) ;
READWRITE ( mapValue ) ;
READWRITE ( thisPtr - > mapValue ) ;
READWRITE ( vOrderForm ) ;
READWRITE ( thisPtr - > vOrderForm ) ;
READWRITE ( fTimeReceivedIsTxTime ) ;
READWRITE ( thisPtr - > fTimeReceivedIsTxTime ) ;
READWRITE ( nTimeReceived ) ;
READWRITE ( thisPtr - > nTimeReceived ) ;
READWRITE ( fFromMe ) ;
READWRITE ( thisPtr - > fFromMe ) ;
READWRITE ( fSpent ) ;
READWRITE ( fSpent ) ;
if ( fRead )
if ( fRead )
@ -636,7 +648,7 @@ public:
ReadOrderPos ( pthis - > nOrderPos , pthis - > mapValue ) ;
ReadOrderPos ( pthis - > nOrderPos , pthis - > mapValue ) ;
pthis - > nTimeSmart = mapValue . count ( " timesmart " ) ? ( unsigned int ) atoi64 ( pthis - > mapValue [ " timesmart " ] ) : 0 ;
pthis - > nTimeSmart = thisPtr - > mapValue . count ( " timesmart " ) ? ( unsigned int ) atoi64 ( pthis - > mapValue [ " timesmart " ] ) : 0 ;
}
}
pthis - > mapValue . erase ( " fromaccount " ) ;
pthis - > mapValue . erase ( " fromaccount " ) ;
@ -644,7 +656,9 @@ public:
pthis - > mapValue . erase ( " spent " ) ;
pthis - > mapValue . erase ( " spent " ) ;
pthis - > mapValue . erase ( " n " ) ;
pthis - > mapValue . erase ( " n " ) ;
pthis - > mapValue . erase ( " timesmart " ) ;
pthis - > mapValue . erase ( " timesmart " ) ;
)
return nSerSize ;
}
// make sure balances are recalculated
// make sure balances are recalculated
void MarkDirty ( )
void MarkDirty ( )
@ -891,14 +905,18 @@ public:
CWalletKey ( int64_t nExpires = 0 ) ;
CWalletKey ( int64_t nExpires = 0 ) ;
IMPLEMENT_SERIALIZE
IMPLEMENT_SERIALIZE
(
template < typename T , typename Stream , typename Operation >
inline static size_t SerializationOp ( T thisPtr , Stream & s , Operation ser_action , int nType , int nVersion ) {
size_t nSerSize = 0 ;
if ( ! ( nType & SER_GETHASH ) )
if ( ! ( nType & SER_GETHASH ) )
READWRITE ( nVersion ) ;
READWRITE ( nVersion ) ;
READWRITE ( vchPrivKey ) ;
READWRITE ( thisPtr - > vchPrivKey ) ;
READWRITE ( nTimeCreated ) ;
READWRITE ( thisPtr - > nTimeCreated ) ;
READWRITE ( nTimeExpires ) ;
READWRITE ( thisPtr - > nTimeExpires ) ;
READWRITE ( LIMITED_STRING ( strComment , 65536 ) ) ;
READWRITE ( LIMITED_STRING ( thisPtr - > strComment , 65536 ) ) ;
)
return nSerSize ;
}
} ;
} ;
@ -925,11 +943,15 @@ public:
}
}
IMPLEMENT_SERIALIZE
IMPLEMENT_SERIALIZE
(
template < typename T , typename Stream , typename Operation >
inline static size_t SerializationOp ( T thisPtr , Stream & s , Operation ser_action , int nType , int nVersion ) {
size_t nSerSize = 0 ;
if ( ! ( nType & SER_GETHASH ) )
if ( ! ( nType & SER_GETHASH ) )
READWRITE ( nVersion ) ;
READWRITE ( nVersion ) ;
READWRITE ( vchPubKey ) ;
READWRITE ( thisPtr - > vchPubKey ) ;
)
return nSerSize ;
}
} ;
} ;
@ -966,38 +988,43 @@ public:
}
}
IMPLEMENT_SERIALIZE
IMPLEMENT_SERIALIZE
(
CAccountingEntry & me = * const_cast < CAccountingEntry * > ( this ) ;
template < typename T , typename Stream , typename Operation >
inline static size_t SerializationOp ( T thisPtr , Stream & s , Operation ser_action , int nType , int nVersion ) {
size_t nSerSize = 0 ;
bool fRead = boost : : is_same < Operation , CSerActionUnserialize > ( ) ;
CAccountingEntry & me = * const_cast < CAccountingEntry * > ( thisPtr ) ;
if ( ! ( nType & SER_GETHASH ) )
if ( ! ( nType & SER_GETHASH ) )
READWRITE ( nVersion ) ;
READWRITE ( nVersion ) ;
// Note: strAccount is serialized as part of the key, not here.
// Note: strAccount is serialized as part of the key, not here.
READWRITE ( nCreditDebit ) ;
READWRITE ( thisPtr - > nCreditDebit ) ;
READWRITE ( nTime ) ;
READWRITE ( thisPtr - > nTime ) ;
READWRITE ( LIMITED_STRING ( strOtherAccount , 65536 ) ) ;
READWRITE ( LIMITED_STRING ( thisPtr - > strOtherAccount , 65536 ) ) ;
if ( ! fRead )
if ( ! fRead )
{
{
WriteOrderPos ( nOrderPos , me . mapValue ) ;
WriteOrderPos ( thisPtr - > nOrderPos , me . mapValue ) ;
if ( ! ( mapValue . empty ( ) & & _ssExtra . empty ( ) ) )
if ( ! ( thisPtr - > mapValue . empty ( ) & & thisPtr - > _ssExtra . empty ( ) ) )
{
{
CDataStream ss ( nType , nVersion ) ;
CDataStream ss ( nType , nVersion ) ;
ss . insert ( ss . begin ( ) , ' \0 ' ) ;
ss . insert ( ss . begin ( ) , ' \0 ' ) ;
ss < < mapValue ;
ss < < thisPtr - > mapValue ;
ss . insert ( ss . end ( ) , _ssExtra . begin ( ) , _ssExtra . end ( ) ) ;
ss . insert ( ss . end ( ) , thisPtr - > _ssExtra . begin ( ) , thisPtr - > _ssExtra . end ( ) ) ;
me . strComment . append ( ss . str ( ) ) ;
me . strComment . append ( ss . str ( ) ) ;
}
}
}
}
READWRITE ( LIMITED_STRING ( strComment , 65536 ) ) ;
READWRITE ( LIMITED_STRING ( thisPtr - > strComment , 65536 ) ) ;
size_t nSepPos = strComment . find ( " \0 " , 0 , 1 ) ;
size_t nSepPos = thisPtr - > strComment . find ( " \0 " , 0 , 1 ) ;
if ( fRead )
if ( fRead )
{
{
me . mapValue . clear ( ) ;
me . mapValue . clear ( ) ;
if ( std : : string : : npos ! = nSepPos )
if ( std : : string : : npos ! = nSepPos )
{
{
CDataStream ss ( std : : vector < char > ( strComment . begin ( ) + nSepPos + 1 , strComment . end ( ) ) , nType , nVersion ) ;
CDataStream ss ( std : : vector < char > ( thisPtr - > strComment . begin ( ) + nSepPos + 1 , thisPtr - > strComment . end ( ) ) , nType , nVersion ) ;
ss > > me . mapValue ;
ss > > me . mapValue ;
me . _ssExtra = std : : vector < char > ( ss . begin ( ) , ss . end ( ) ) ;
me . _ssExtra = std : : vector < char > ( ss . begin ( ) , ss . end ( ) ) ;
}
}
@ -1007,7 +1034,9 @@ public:
me . strComment . erase ( nSepPos ) ;
me . strComment . erase ( nSepPos ) ;
me . mapValue . erase ( " n " ) ;
me . mapValue . erase ( " n " ) ;
)
return nSerSize ;
}
private :
private :
std : : vector < char > _ssExtra ;
std : : vector < char > _ssExtra ;