user24926: I wrote a script that compares the transactions listed in the memory pool with the transactions included in getblocktemplate:
http://learnmeabitcoin.com/explorer/node/memorypool
(I've ordered the transactions by [current priority], and highlighted the ones included in getblocktemplate in blue.)

How does getblocktemplate choose which transactions to include from the memory pool in a candidate block?
Why aren't transactions being selected from highest to lowest priority?


user35841: The whole mempool won't fit in a block; getblocktemplate returns enough transactions for a block. Blocks are, by default, limited to 750kb by policy, but many miners increase the size to the block limit of 1mb (which can be done by command-line flag).
The specific piece of code that decides on the transactions that should be included in a block can be found here. It's reasonably well documented, and not terrible to read, I'd suggest taking a look through it to see where your script operates differently.

24926: <p>I wrote a script that compares the transactions listed in the <strong>memory pool</strong> with the transactions included in <code>getblocktemplate</code>:</p>

<p><a href="http://learnmeabitcoin.com/explorer/node/memorypool" rel="nofollow">http://learnmeabitcoin.com/explorer/node/memorypool</a></p>

<p><em>(I've ordered the transactions by [current priority], and highlighted the ones included in <code>getblocktemplate</code> in blue.)</em></p>

<ul>
<li><p>How does <code>getblocktemplate</code> choose which transactions to include from the memory pool in a candidate block?</p></li>
<li><p>Why aren't transactions being selected from highest to lowest priority?</p></li>
</ul>
 35841: <p>The whole mempool won't fit in a block; <code>getblocktemplate</code> returns enough transactions for a block. Blocks are, by default, <a href="https://github.com/bitcoin/bitcoin/blob/a6a860796a44a2805a58391a009ba22752f64e32/src/policy/policy.h#L18" rel="noreferrer">limited to 750kb by policy</a>, but many miners increase the size to the block limit of 1mb (which can be done by command-line flag).</p>

<p>The specific piece of code that decides on the transactions that should be included in a block <a href="https://github.com/bitcoin/bitcoin/blob/86b800c6a299455580fe76e5fb43218f0222e179/src/miner.cpp#L113" rel="noreferrer">can be found here</a>. It's reasonably well documented, and not terrible to read, I'd suggest taking a look through it to see where your script operates differently.</p>
