I have tried to serialize as follows without success: bitcoin tag v22.0 from github.
In the file src/miner.cpp
and the function
I have placed the line std::cout << pblock << std::endl;
at the very end before it returns (Here). The value that is printed to the terminal is:
0x7fc9f4009410
This is too little data, I would expect the entire block data to be serialized and printed in hex. What am I doing wrong? I know pblock is a pointer to a CBlock class, but it should still work.
What is the proper way to serialize CBlock data, and also the CBlockHeader data?
Thank you!
std::unique_ptr
, the<<
operator outputs the pointer value rather than the object pointed to. Try dereferencing the pointer first.