| 70 | } |
| 71 | |
| 72 | bool CBloomFilter::IsRelevantAndUpdate(CBaseTx* pBaseTx, const uint256& hash) { |
| 73 | // bool fFound = false; |
| 74 | // Match if the filter contains the hash of tx |
| 75 | // for finding tx when they appear in a block |
| 76 | if (isFull) |
| 77 | return true; |
| 78 | if (isEmpty) |
| 79 | return false; |
| 80 | // if (contains(hash)) |
| 81 | // fFound = true; |
| 82 | |
| 83 | // for (uint32_t i = 0; i < tx.vout.size(); i++) |
| 84 | // { |
| 85 | // const CTxOut& txout = tx.vout[i]; |
| 86 | // // Match if the filter contains any arbitrary script data element in any scriptPubKey in tx |
| 87 | // // If this matches, also add the specific output that was matched. |
| 88 | // // This means clients don't have to update the filter themselves when a new relevant tx |
| 89 | // // is discovered in order to find spending transactions, which avoids round-tripping and race conditions. |
| 90 | // CScript::const_iterator pc = txout.scriptPubKey.begin(); |
| 91 | // vector<uint8_t> data; |
| 92 | // while (pc < txout.scriptPubKey.end()) |
| 93 | // { |
| 94 | // opcodetype opcode; |
| 95 | // if (!txout.scriptPubKey.GetOp(pc, opcode, data)) |
| 96 | // break; |
| 97 | // if (data.size() != 0 && contains(data)) |
| 98 | // { |
| 99 | // fFound = true; |
| 100 | // if ((nFlags & BLOOM_UPDATE_MASK) == BLOOM_UPDATE_ALL) |
| 101 | // insert(COutPoint(hash, i)); |
| 102 | // else if ((nFlags & BLOOM_UPDATE_MASK) == BLOOM_UPDATE_P2PUBKEY_ONLY) |
| 103 | // { |
| 104 | // txnouttype type; |
| 105 | // vector<vector<uint8_t> > vSolutions; |
| 106 | // if (Solver(txout.scriptPubKey, type, vSolutions) && |
| 107 | // (type == TX_PUBKEY || type == TX_MULTISIG)) |
| 108 | // insert(COutPoint(hash, i)); |
| 109 | // } |
| 110 | // break; |
| 111 | // } |
| 112 | // } |
| 113 | // } |
| 114 | // |
| 115 | // if (fFound) |
| 116 | // return true; |
| 117 | // |
| 118 | // BOOST_FOREACH(const CTxIn& txin, tx.vin) |
| 119 | // { |
| 120 | // // Match if the filter contains an outpoint tx spends |
| 121 | // if (contains(txin.prevout)) |
| 122 | // return true; |
| 123 | // |
| 124 | // // Match if the filter contains any arbitrary script data element in any scriptSig in tx |
| 125 | // CScript::const_iterator pc = txin.scriptSig.begin(); |
| 126 | // vector<uint8_t> data; |
| 127 | // while (pc < txin.scriptSig.end()) |
| 128 | // { |
| 129 | // opcodetype opcode; |