Merge pull request #2188 from TheBlueMatt/bloom
Send transactions after a CMerkleBlock when asked for it in an inv.
This commit is contained in:
commit
1a2e45d8d5
3 changed files with 6 additions and 4 deletions
|
@ -3260,6 +3260,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||||
if (pfrom->pfilter)
|
if (pfrom->pfilter)
|
||||||
{
|
{
|
||||||
CMerkleBlock merkleBlock(block, *pfrom->pfilter);
|
CMerkleBlock merkleBlock(block, *pfrom->pfilter);
|
||||||
|
pfrom->PushMessage("merkleblock", merkleBlock);
|
||||||
// CMerkleBlock just contains hashes, so also push any transactions in the block the client did not see
|
// CMerkleBlock just contains hashes, so also push any transactions in the block the client did not see
|
||||||
// This avoids hurting performance by pointlessly requiring a round-trip
|
// This avoids hurting performance by pointlessly requiring a round-trip
|
||||||
// Note that there is currently no way for a node to request any single transactions we didnt send here -
|
// Note that there is currently no way for a node to request any single transactions we didnt send here -
|
||||||
|
@ -3270,7 +3271,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||||
BOOST_FOREACH(PairType& pair, merkleBlock.vMatchedTxn)
|
BOOST_FOREACH(PairType& pair, merkleBlock.vMatchedTxn)
|
||||||
if (!pfrom->setInventoryKnown.count(CInv(MSG_TX, pair.second)))
|
if (!pfrom->setInventoryKnown.count(CInv(MSG_TX, pair.second)))
|
||||||
pfrom->PushMessage("tx", block.vtx[pair.first]);
|
pfrom->PushMessage("tx", block.vtx[pair.first]);
|
||||||
pfrom->PushMessage("merkleblock", merkleBlock);
|
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// no response
|
// no response
|
||||||
|
@ -3581,7 +3581,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||||
|
|
||||||
// Nodes must NEVER send a data item > 520 bytes (the max size for a script data object,
|
// Nodes must NEVER send a data item > 520 bytes (the max size for a script data object,
|
||||||
// and thus, the maximum size any matched object can have) in a filteradd message
|
// and thus, the maximum size any matched object can have) in a filteradd message
|
||||||
if (vData.size() > 520)
|
if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE)
|
||||||
{
|
{
|
||||||
pfrom->Misbehaving(100);
|
pfrom->Misbehaving(100);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -340,7 +340,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
|
||||||
//
|
//
|
||||||
if (!script.GetOp(pc, opcode, vchPushValue))
|
if (!script.GetOp(pc, opcode, vchPushValue))
|
||||||
return false;
|
return false;
|
||||||
if (vchPushValue.size() > 520)
|
if (vchPushValue.size() > MAX_SCRIPT_ELEMENT_SIZE)
|
||||||
return false;
|
return false;
|
||||||
if (opcode > OP_16 && ++nOpCount > 201)
|
if (opcode > OP_16 && ++nOpCount > 201)
|
||||||
return false;
|
return false;
|
||||||
|
@ -670,7 +670,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
|
||||||
valtype& vch2 = stacktop(-1);
|
valtype& vch2 = stacktop(-1);
|
||||||
vch1.insert(vch1.end(), vch2.begin(), vch2.end());
|
vch1.insert(vch1.end(), vch2.begin(), vch2.end());
|
||||||
popstack(stack);
|
popstack(stack);
|
||||||
if (stacktop(-1).size() > 520)
|
if (stacktop(-1).size() > MAX_SCRIPT_ELEMENT_SIZE)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
class CCoins;
|
class CCoins;
|
||||||
class CTransaction;
|
class CTransaction;
|
||||||
|
|
||||||
|
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes
|
||||||
|
|
||||||
/** Signature hash types/flags */
|
/** Signature hash types/flags */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue