Fix serialization in Insight explorer code.
Remove nType and nVersion from serialization Fix CScript serialization
This commit is contained in:
parent
822e02d9c9
commit
ba411d17a2
68
src/main.h
68
src/main.h
|
@ -281,11 +281,11 @@ struct CTimestampIndexIteratorKey {
|
|||
return 4;
|
||||
}
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
||||
void Serialize(Stream& s) const {
|
||||
ser_writedata32be(s, timestamp);
|
||||
}
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
||||
void Unserialize(Stream& s) {
|
||||
timestamp = ser_readdata32be(s);
|
||||
}
|
||||
|
||||
|
@ -310,14 +310,14 @@ struct CTimestampIndexKey {
|
|||
return 36;
|
||||
}
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
||||
void Serialize(Stream& s) const {
|
||||
ser_writedata32be(s, timestamp);
|
||||
blockHash.Serialize(s, nType, nVersion);
|
||||
blockHash.Serialize(s);
|
||||
}
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
||||
void Unserialize(Stream& s) {
|
||||
timestamp = ser_readdata32be(s);
|
||||
blockHash.Unserialize(s, nType, nVersion);
|
||||
blockHash.Unserialize(s);
|
||||
}
|
||||
|
||||
CTimestampIndexKey(unsigned int time, uint256 hash) {
|
||||
|
@ -343,13 +343,13 @@ struct CTimestampBlockIndexKey {
|
|||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
||||
blockHash.Serialize(s, nType, nVersion);
|
||||
void Serialize(Stream& s) const {
|
||||
blockHash.Serialize(s);
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
||||
blockHash.Unserialize(s, nType, nVersion);
|
||||
void Unserialize(Stream& s) {
|
||||
blockHash.Unserialize(s);
|
||||
}
|
||||
|
||||
CTimestampBlockIndexKey(uint256 hash) {
|
||||
|
@ -372,12 +372,12 @@ struct CTimestampBlockIndexValue {
|
|||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
||||
void Serialize(Stream& s) const {
|
||||
ser_writedata32be(s, ltimestamp);
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
||||
void Unserialize(Stream& s) {
|
||||
ltimestamp = ser_readdata32be(s);
|
||||
}
|
||||
|
||||
|
@ -404,17 +404,17 @@ struct CAddressUnspentKey {
|
|||
return 57;
|
||||
}
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
||||
void Serialize(Stream& s) const {
|
||||
ser_writedata8(s, type);
|
||||
hashBytes.Serialize(s, nType, nVersion);
|
||||
txhash.Serialize(s, nType, nVersion);
|
||||
hashBytes.Serialize(s);
|
||||
txhash.Serialize(s);
|
||||
ser_writedata32(s, index);
|
||||
}
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
||||
void Unserialize(Stream& s) {
|
||||
type = ser_readdata8(s);
|
||||
hashBytes.Unserialize(s, nType, nVersion);
|
||||
txhash.Unserialize(s, nType, nVersion);
|
||||
hashBytes.Unserialize(s);
|
||||
txhash.Unserialize(s);
|
||||
index = ser_readdata32(s);
|
||||
}
|
||||
|
||||
|
@ -445,9 +445,9 @@ struct CAddressUnspentValue {
|
|||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
READWRITE(satoshis);
|
||||
READWRITE(script);
|
||||
READWRITE(*(CScriptBase*)(&script));
|
||||
READWRITE(blockHeight);
|
||||
}
|
||||
|
||||
|
@ -485,24 +485,24 @@ struct CAddressIndexKey {
|
|||
return 66;
|
||||
}
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
||||
void Serialize(Stream& s) const {
|
||||
ser_writedata8(s, type);
|
||||
hashBytes.Serialize(s, nType, nVersion);
|
||||
hashBytes.Serialize(s);
|
||||
// Heights are stored big-endian for key sorting in LevelDB
|
||||
ser_writedata32be(s, blockHeight);
|
||||
ser_writedata32be(s, txindex);
|
||||
txhash.Serialize(s, nType, nVersion);
|
||||
txhash.Serialize(s);
|
||||
ser_writedata32(s, index);
|
||||
char f = spending;
|
||||
ser_writedata8(s, f);
|
||||
}
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
||||
void Unserialize(Stream& s) {
|
||||
type = ser_readdata8(s);
|
||||
hashBytes.Unserialize(s, nType, nVersion);
|
||||
hashBytes.Unserialize(s);
|
||||
blockHeight = ser_readdata32be(s);
|
||||
txindex = ser_readdata32be(s);
|
||||
txhash.Unserialize(s, nType, nVersion);
|
||||
txhash.Unserialize(s);
|
||||
index = ser_readdata32(s);
|
||||
char f = ser_readdata8(s);
|
||||
spending = f;
|
||||
|
@ -543,14 +543,14 @@ struct CAddressIndexIteratorKey {
|
|||
return 21;
|
||||
}
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
||||
void Serialize(Stream& s) const {
|
||||
ser_writedata8(s, type);
|
||||
hashBytes.Serialize(s, nType, nVersion);
|
||||
hashBytes.Serialize(s);
|
||||
}
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
||||
void Unserialize(Stream& s) {
|
||||
type = ser_readdata8(s);
|
||||
hashBytes.Unserialize(s, nType, nVersion);
|
||||
hashBytes.Unserialize(s);
|
||||
}
|
||||
|
||||
CAddressIndexIteratorKey(unsigned int addressType, uint160 addressHash) {
|
||||
|
@ -577,15 +577,15 @@ struct CAddressIndexIteratorHeightKey {
|
|||
return 25;
|
||||
}
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
||||
void Serialize(Stream& s) const {
|
||||
ser_writedata8(s, type);
|
||||
hashBytes.Serialize(s, nType, nVersion);
|
||||
hashBytes.Serialize(s);
|
||||
ser_writedata32be(s, blockHeight);
|
||||
}
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
||||
void Unserialize(Stream& s) {
|
||||
type = ser_readdata8(s);
|
||||
hashBytes.Unserialize(s, nType, nVersion);
|
||||
hashBytes.Unserialize(s);
|
||||
blockHeight = ser_readdata32be(s);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ struct CSpentIndexKey {
|
|||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
READWRITE(txid);
|
||||
READWRITE(outputIndex);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ struct CSpentIndexValue {
|
|||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
READWRITE(txid);
|
||||
READWRITE(inputIndex);
|
||||
READWRITE(blockHeight);
|
||||
|
|
Loading…
Reference in New Issue