mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-20 20:49:50 +01:00
blockfilter: Omit empty scripts from filter contents.
Code change also avoids out-of-bounds script access bug.
This commit is contained in:
@@ -208,7 +208,7 @@ static GCSFilter::ElementSet BasicFilterElements(const CBlock& block,
|
||||
for (const CTransactionRef& tx : block.vtx) {
|
||||
for (const CTxOut& txout : tx->vout) {
|
||||
const CScript& script = txout.scriptPubKey;
|
||||
if (script[0] == OP_RETURN) continue;
|
||||
if (script.empty() || script[0] == OP_RETURN) continue;
|
||||
elements.emplace(script.begin(), script.end());
|
||||
}
|
||||
}
|
||||
@@ -216,6 +216,7 @@ static GCSFilter::ElementSet BasicFilterElements(const CBlock& block,
|
||||
for (const CTxUndo& tx_undo : block_undo.vtxundo) {
|
||||
for (const Coin& prevout : tx_undo.vprevout) {
|
||||
const CScript& script = prevout.out.scriptPubKey;
|
||||
if (script.empty()) continue;
|
||||
elements.emplace(script.begin(), script.end());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user