mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Use ParamsWrapper for witness serialization
This commit is contained in:
@@ -956,7 +956,7 @@ bool BlockManager::WriteBlockToDisk(const CBlock& block, FlatFilePos& pos) const
|
||||
}
|
||||
|
||||
// Write index header
|
||||
unsigned int nSize = GetSerializeSize(block, fileout.GetVersion());
|
||||
unsigned int nSize = GetSerializeSize(TX_WITH_WITNESS(block));
|
||||
fileout << GetParams().MessageStart() << nSize;
|
||||
|
||||
// Write block
|
||||
@@ -965,7 +965,7 @@ bool BlockManager::WriteBlockToDisk(const CBlock& block, FlatFilePos& pos) const
|
||||
return error("WriteBlockToDisk: ftell failed");
|
||||
}
|
||||
pos.nPos = (unsigned int)fileOutPos;
|
||||
fileout << block;
|
||||
fileout << TX_WITH_WITNESS(block);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1023,7 +1023,7 @@ bool BlockManager::ReadBlockFromDisk(CBlock& block, const FlatFilePos& pos) cons
|
||||
|
||||
// Read block
|
||||
try {
|
||||
filein >> block;
|
||||
filein >> TX_WITH_WITNESS(block);
|
||||
} catch (const std::exception& e) {
|
||||
return error("%s: Deserialize or I/O error - %s at %s", __func__, e.what(), pos.ToString());
|
||||
}
|
||||
@@ -1092,7 +1092,7 @@ bool BlockManager::ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatF
|
||||
|
||||
FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight, const FlatFilePos* dbp)
|
||||
{
|
||||
unsigned int nBlockSize = ::GetSerializeSize(block, CLIENT_VERSION);
|
||||
unsigned int nBlockSize = ::GetSerializeSize(TX_WITH_WITNESS(block));
|
||||
FlatFilePos blockPos;
|
||||
const auto position_known {dbp != nullptr};
|
||||
if (position_known) {
|
||||
|
||||
@@ -775,7 +775,7 @@ public:
|
||||
{
|
||||
RPCRunLater(name, std::move(fn), seconds);
|
||||
}
|
||||
int rpcSerializationFlags() override { return RPCSerializationFlags(); }
|
||||
bool rpcSerializationWithoutWitness() override { return RPCSerializationWithoutWitness(); }
|
||||
common::SettingsValue getSetting(const std::string& name) override
|
||||
{
|
||||
return args().GetSetting(name);
|
||||
|
||||
Reference in New Issue
Block a user