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;
|
return 4;
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
void Serialize(Stream& s) const {
|
||||||
ser_writedata32be(s, timestamp);
|
ser_writedata32be(s, timestamp);
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
void Unserialize(Stream& s) {
|
||||||
timestamp = ser_readdata32be(s);
|
timestamp = ser_readdata32be(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,14 +310,14 @@ struct CTimestampIndexKey {
|
||||||
return 36;
|
return 36;
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
void Serialize(Stream& s) const {
|
||||||
ser_writedata32be(s, timestamp);
|
ser_writedata32be(s, timestamp);
|
||||||
blockHash.Serialize(s, nType, nVersion);
|
blockHash.Serialize(s);
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
void Unserialize(Stream& s) {
|
||||||
timestamp = ser_readdata32be(s);
|
timestamp = ser_readdata32be(s);
|
||||||
blockHash.Unserialize(s, nType, nVersion);
|
blockHash.Unserialize(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTimestampIndexKey(unsigned int time, uint256 hash) {
|
CTimestampIndexKey(unsigned int time, uint256 hash) {
|
||||||
|
@ -343,13 +343,13 @@ struct CTimestampBlockIndexKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
void Serialize(Stream& s) const {
|
||||||
blockHash.Serialize(s, nType, nVersion);
|
blockHash.Serialize(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
void Unserialize(Stream& s) {
|
||||||
blockHash.Unserialize(s, nType, nVersion);
|
blockHash.Unserialize(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTimestampBlockIndexKey(uint256 hash) {
|
CTimestampBlockIndexKey(uint256 hash) {
|
||||||
|
@ -372,12 +372,12 @@ struct CTimestampBlockIndexValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
void Serialize(Stream& s) const {
|
||||||
ser_writedata32be(s, ltimestamp);
|
ser_writedata32be(s, ltimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
void Unserialize(Stream& s) {
|
||||||
ltimestamp = ser_readdata32be(s);
|
ltimestamp = ser_readdata32be(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,17 +404,17 @@ struct CAddressUnspentKey {
|
||||||
return 57;
|
return 57;
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
void Serialize(Stream& s) const {
|
||||||
ser_writedata8(s, type);
|
ser_writedata8(s, type);
|
||||||
hashBytes.Serialize(s, nType, nVersion);
|
hashBytes.Serialize(s);
|
||||||
txhash.Serialize(s, nType, nVersion);
|
txhash.Serialize(s);
|
||||||
ser_writedata32(s, index);
|
ser_writedata32(s, index);
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
void Unserialize(Stream& s) {
|
||||||
type = ser_readdata8(s);
|
type = ser_readdata8(s);
|
||||||
hashBytes.Unserialize(s, nType, nVersion);
|
hashBytes.Unserialize(s);
|
||||||
txhash.Unserialize(s, nType, nVersion);
|
txhash.Unserialize(s);
|
||||||
index = ser_readdata32(s);
|
index = ser_readdata32(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,9 +445,9 @@ struct CAddressUnspentValue {
|
||||||
ADD_SERIALIZE_METHODS;
|
ADD_SERIALIZE_METHODS;
|
||||||
|
|
||||||
template <typename Stream, typename Operation>
|
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(satoshis);
|
||||||
READWRITE(script);
|
READWRITE(*(CScriptBase*)(&script));
|
||||||
READWRITE(blockHeight);
|
READWRITE(blockHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,24 +485,24 @@ struct CAddressIndexKey {
|
||||||
return 66;
|
return 66;
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
void Serialize(Stream& s) const {
|
||||||
ser_writedata8(s, type);
|
ser_writedata8(s, type);
|
||||||
hashBytes.Serialize(s, nType, nVersion);
|
hashBytes.Serialize(s);
|
||||||
// Heights are stored big-endian for key sorting in LevelDB
|
// Heights are stored big-endian for key sorting in LevelDB
|
||||||
ser_writedata32be(s, blockHeight);
|
ser_writedata32be(s, blockHeight);
|
||||||
ser_writedata32be(s, txindex);
|
ser_writedata32be(s, txindex);
|
||||||
txhash.Serialize(s, nType, nVersion);
|
txhash.Serialize(s);
|
||||||
ser_writedata32(s, index);
|
ser_writedata32(s, index);
|
||||||
char f = spending;
|
char f = spending;
|
||||||
ser_writedata8(s, f);
|
ser_writedata8(s, f);
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
void Unserialize(Stream& s) {
|
||||||
type = ser_readdata8(s);
|
type = ser_readdata8(s);
|
||||||
hashBytes.Unserialize(s, nType, nVersion);
|
hashBytes.Unserialize(s);
|
||||||
blockHeight = ser_readdata32be(s);
|
blockHeight = ser_readdata32be(s);
|
||||||
txindex = ser_readdata32be(s);
|
txindex = ser_readdata32be(s);
|
||||||
txhash.Unserialize(s, nType, nVersion);
|
txhash.Unserialize(s);
|
||||||
index = ser_readdata32(s);
|
index = ser_readdata32(s);
|
||||||
char f = ser_readdata8(s);
|
char f = ser_readdata8(s);
|
||||||
spending = f;
|
spending = f;
|
||||||
|
@ -543,14 +543,14 @@ struct CAddressIndexIteratorKey {
|
||||||
return 21;
|
return 21;
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
void Serialize(Stream& s) const {
|
||||||
ser_writedata8(s, type);
|
ser_writedata8(s, type);
|
||||||
hashBytes.Serialize(s, nType, nVersion);
|
hashBytes.Serialize(s);
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
void Unserialize(Stream& s) {
|
||||||
type = ser_readdata8(s);
|
type = ser_readdata8(s);
|
||||||
hashBytes.Unserialize(s, nType, nVersion);
|
hashBytes.Unserialize(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAddressIndexIteratorKey(unsigned int addressType, uint160 addressHash) {
|
CAddressIndexIteratorKey(unsigned int addressType, uint160 addressHash) {
|
||||||
|
@ -577,15 +577,15 @@ struct CAddressIndexIteratorHeightKey {
|
||||||
return 25;
|
return 25;
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Serialize(Stream& s, int nType, int nVersion) const {
|
void Serialize(Stream& s) const {
|
||||||
ser_writedata8(s, type);
|
ser_writedata8(s, type);
|
||||||
hashBytes.Serialize(s, nType, nVersion);
|
hashBytes.Serialize(s);
|
||||||
ser_writedata32be(s, blockHeight);
|
ser_writedata32be(s, blockHeight);
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
void Unserialize(Stream& s, int nType, int nVersion) {
|
void Unserialize(Stream& s) {
|
||||||
type = ser_readdata8(s);
|
type = ser_readdata8(s);
|
||||||
hashBytes.Unserialize(s, nType, nVersion);
|
hashBytes.Unserialize(s);
|
||||||
blockHeight = ser_readdata32be(s);
|
blockHeight = ser_readdata32be(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct CSpentIndexKey {
|
||||||
ADD_SERIALIZE_METHODS;
|
ADD_SERIALIZE_METHODS;
|
||||||
|
|
||||||
template <typename Stream, typename Operation>
|
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(txid);
|
||||||
READWRITE(outputIndex);
|
READWRITE(outputIndex);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ struct CSpentIndexValue {
|
||||||
ADD_SERIALIZE_METHODS;
|
ADD_SERIALIZE_METHODS;
|
||||||
|
|
||||||
template <typename Stream, typename Operation>
|
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(txid);
|
||||||
READWRITE(inputIndex);
|
READWRITE(inputIndex);
|
||||||
READWRITE(blockHeight);
|
READWRITE(blockHeight);
|
||||||
|
|
Loading…
Reference in New Issue