We are trying to build the App for eMark Client.
The App connects to the other Clients and Synchronize to ~10.000 Blocks before "last block".
Then it comes "invites" and the App replies with:
The Client has to response with:
https://github.com/emarkproject/eMark/blob/master/src/main.cpp#L2796
We have modify the funktion like this:
{
std::deque
vector
LOCK(cs_main);
while (it != pfrom->vRecvGetData.end()) {
// Don't bother if send buffer is too full to respond anyway
if (pfrom->nSendSize >= SendBufferSize())
break;
const CInv &inv = *it;
{
boost::this_thread::interruption_point();
it++;
if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK)
{
// Send block from disk
map
if (mi != mapBlockIndex.end())
{
CBlock block;
if (!block.ReadFromDisk((*mi).second)) {
assert(!"cannot load block from disk");
}
if (inv.type == MSG_BLOCK) {
pfrom->PushMessage("block", block);
}
else {
CBlockIndex *pindex = NULL;
pindex = (*mi).second;
pindex = pindex->pnext;
map
pindex = (*mi).second;
pindex = pindex->pnext;
pfrom->PushMessage("merkleblock", pindex->GetBlockHeader());
cout << "Merkleblock sended\n";
//typedef std::pair
//foreach found Transactions
//BOOST_FOREACH(PairType& pair, merkleBlock.vMatchedTxn)
//send TRANSACTION
//pfrom->PushMessage(NetMsgType::TX, block.vtx[pair.first]);
}
// Trigger them to send a getblocks request for the next batch of inventory
if (inv.hash == pfrom->hashContinue)
{
// Bypass PushInventory, this must send even if redundant,
// and we want it right after the last block so they don't
// wait for other stuff first.
vector
vInv.push_back(CInv(MSG_BLOCK, hashBestChain));
pfrom->PushMessage("inv", vInv);
pfrom->hashContinue = 0;
}
}
}
else if (inv.IsKnownType())
{
// Send stream from relay memory
bool pushed = false;
{
LOCK(cs_mapRelay);
map
if (mi != mapRelay.end()) {
pfrom->PushMessage(inv.GetCommand(), (*mi).second);
pushed = true;
}
}
if (!pushed && inv.type == MSG_TX) {
CTransaction tx;
if (mempool.lookup(inv.hash, tx)) {
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss.reserve(1000);
ss << tx;
pfrom->PushMessage("tx", ss);
pushed = true;
}
}
if (!pushed) {
vNotFound.push_back(inv);
}
}
// Track requests for our stuff.
g_signals.Inventory(inv.hash);
if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK)
break;
}
}
pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it);
if (!vNotFound.empty()) {
// Let the peer know that we didn't find what it asked for, so it doesn't
// have to wait around forever. Currently only SPV clients actually care
// about this message: it's needed when they are recursively walking the
// dependencies of relevant unconfirmed transactions. SPV clients want to
// do that because they want to know about (and store and rebroadcast and
// risk analyze) the dependencies of transactions relevant to them, without
// having to download the entire memory pool.
pfrom->PushMessage("notfound", vNotFound);
}
}
see at line:
But this doesn't work, because its not the merkleblock. Its only the header of the merkleblock.
Can you help us, what to do?
At this moment, we only need to know, how to read the complete merkleblock like this:
Thank you.
(sry for my bad englisch)