Skip to content

Conversation

@brunoerg
Copy link
Contributor

@brunoerg brunoerg commented Jan 25, 2023

When processing CMPCTBLOCK message, at some moments we can need to process compact block txns / BLOCKTXN, since all messages are handled by ProcessMessage, so we call ProcessMessage all over again.

bitcoin/src/net_processing.cpp

Lines 4331 to 4348 in ab98673

if (fAlreadyInFlight) {
// We requested this block, but its far into the future, so our
// mempool will probably be useless - request the block normally
std::vector<CInv> vInv(1);
vInv[0] = CInv(MSG_BLOCK | GetFetchFlags(*peer), cmpctblock.header.GetHash());
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETDATA, vInv));
return;
} else {
// If this was an announce-cmpctblock, we want the same treatment as a header message
fRevertToHeaderProcessing = true;
}
}
} // cs_main
if (fProcessBLOCKTXN) {
return ProcessMessage(pfrom, NetMsgType::BLOCKTXN, blockTxnMsg, time_received, interruptMsgProc);
}

This PR creates a function called ProcessCompactBlockTxns to process it to avoid calling ProcessMessage for it - this function is also called when processing BLOCKTXN msg.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 25, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK instagibbs, ajtowns, achow101
Concept ACK Sjors
Stale ACK dergoegge

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #27826 (validation: log which peer sent us a header by Sjors)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@DrahtBot DrahtBot added the P2P label Jan 25, 2023
@dergoegge
Copy link
Member

Concept ACK

@brunoerg brunoerg changed the title net: net_processing, add ProcessBlockTxnMessage net: net_processing, add ProcessCompactBlockTxns Jan 26, 2023
@brunoerg brunoerg changed the title net: net_processing, add ProcessCompactBlockTxns net: net_processing, add ProcessCompactBlockTxns Jan 26, 2023
@brunoerg
Copy link
Contributor Author

Force-pushed addressing @ajtowns's suggestion.

@brunoerg brunoerg force-pushed the 2023-01-netprocessing-txn branch from 3e95e62 to c17e71b Compare January 26, 2023 16:19
@brunoerg brunoerg force-pushed the 2023-01-netprocessing-txn branch from c17e71b to 9001051 Compare January 26, 2023 17:11
@brunoerg brunoerg force-pushed the 2023-01-netprocessing-txn branch from 9001051 to fd27f29 Compare January 27, 2023 18:05
@brunoerg
Copy link
Contributor Author

Rebased

@brunoerg brunoerg changed the title net: net_processing, add ProcessCompactBlockTxns net, refactor: net_processing, add ProcessCompactBlockTxns Feb 2, 2023
@brunoerg brunoerg force-pushed the 2023-01-netprocessing-txn branch 2 times, most recently from 1f7f871 to 3cd4578 Compare February 2, 2023 19:28
@brunoerg brunoerg force-pushed the 2023-01-netprocessing-txn branch from 3cd4578 to e57f912 Compare March 2, 2023 17:51
@brunoerg
Copy link
Contributor Author

brunoerg commented Mar 2, 2023

Force-pushed addressing #26969 (comment) (@dergoegge)

@DrahtBot DrahtBot mentioned this pull request Mar 19, 2023
@brunoerg brunoerg force-pushed the 2023-01-netprocessing-txn branch from e57f912 to fe4ad5f Compare March 21, 2023 20:30
@brunoerg
Copy link
Contributor Author

Rebased

@ajtowns
Copy link
Contributor

ajtowns commented Jun 6, 2023

ACK 355bc6098a7373feb1d59f9651a79e1477d22243

@brunoerg brunoerg force-pushed the 2023-01-netprocessing-txn branch from 355bc60 to 686629d Compare June 7, 2023 14:43
@instagibbs
Copy link
Member

re ACK 686629d

only differences beyond rebase is suggested changes for ProcessCompactBlockTxns argument ordering and const-ness of BlockTransactions arg.

@DrahtBot DrahtBot requested a review from ajtowns June 7, 2023 14:46
@brunoerg
Copy link
Contributor Author

brunoerg commented Jun 7, 2023

Force-pushed addressing #26969 (comment)

@ajtowns
Copy link
Contributor

ajtowns commented Jun 8, 2023

re ACK 686629d2be5545ef59cf0e97f4f3a74c6cde2efa

@DrahtBot DrahtBot removed the request for review from ajtowns June 8, 2023 00:04
Copy link
Member

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 686629d2be5545ef59cf0e97f4f3a74c6cde2efa

@brunoerg brunoerg force-pushed the 2023-01-netprocessing-txn branch from 686629d to 89478af Compare June 12, 2023 13:30
@brunoerg
Copy link
Contributor Author

Rebased

@instagibbs
Copy link
Member

reACK 89478af

Copy link
Contributor

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reACK 89478af481b2e6d4652b2fe50ff5fe5b92cbd69e

When processing `CMPCTBLOCK` message, at some moments
we can need to process cmpct block txns, since all messages
are handled by ProcessMessage, we call ProcessMessage
all over again. For this reason, it creates a function called
`ProcessCompactBlockTxns` to process it.
@brunoerg brunoerg force-pushed the 2023-01-netprocessing-txn branch from 89478af to 77d6d89 Compare June 15, 2023 15:23
@brunoerg
Copy link
Contributor Author

Force-pushed addressing #26969 (comment)

@instagibbs
Copy link
Member

reACK 77d6d89

@DrahtBot DrahtBot requested a review from ajtowns June 15, 2023 15:50
@ajtowns
Copy link
Contributor

ajtowns commented Jun 23, 2023

utACK 77d6d89

@DrahtBot DrahtBot removed the request for review from ajtowns June 23, 2023 14:28
@achow101
Copy link
Member

ACK 77d6d89

Verified diff is primarily a moveonly that removes the recursion for BLOCKTXN.

@achow101 achow101 merged commit 50a664a into bitcoin:master Jun 23, 2023
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 25, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Jun 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants