MCPcopy Create free account
hub / github.com/ElementsProject/elements / Unserialize

Method Unserialize

src/primitives/block.h:280–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278
279 template <typename Stream>
280 inline void Unserialize(Stream& s) {
281 const bool fAllowWitness = !(s.GetVersion() & SERIALIZE_TRANSACTION_NO_WITNESS);
282
283 // Detect dynamic federation block serialization using "HF bit",
284 // or the signed bit which is invalid in Bitcoin
285 bool is_dyna = false;
286 int32_t nVersion;
287 s >> nVersion;
288 is_dyna = nVersion < 0;
289 this->nVersion = ~DYNAFED_HF_MASK & nVersion;
290
291 if (is_dyna) {
292 s >> hashPrevBlock;
293 s >> hashMerkleRoot;
294 s >> nTime;
295 s >> block_height;
296 s >> m_dynafed_params;
297 // We do not serialize witness for hashes, or weight calculation
298 if (!(s.GetType() & SER_GETHASH) && fAllowWitness) {
299 s >> m_signblock_witness.stack;
300 }
301 } else {
302 s >> hashPrevBlock;
303 s >> hashMerkleRoot;
304 s >> nTime;
305 if (g_con_blockheightinheader) {
306 s >> block_height;
307 }
308 if (g_signed_blocks) {
309 s >> proof;
310 } else {
311 s >> nBits;
312 s >> nNonce;
313 }
314 }
315 }
316
317 void SetNull()
318 {

Callers

nothing calls this directly

Calls 2

GetVersionMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected