user638: I see from the source code (script.cpp) that there is an upper limit in the script size. It there any other limit to avoid a single transaction preventing other transactions of smaller sizes to get into a block?
How is this kind of attack prevented?
I've read in CTransaction::AcceptToMemoryPool the line:
if .... ::GetSerializeSize(*this, SER_NETWORK) < 100) 
    return error("..."); 

Does this line means that the maximum transaction size is 100 bytes?

user307: If there is a max transaction size it is much higher than 100 bytes. Not sure what that snippet is refering to but the average transaction is closer to ~300 bytes looking at the average # of transactions and block size for last 1000 blocks.
What limits transaction size is cost.  As transaction size (of all transactions awaiting next block) increases the min required fee increases non-linearly.  

0.01 BTC fee per kilobyte of transaction, but: 
  If the blocksize (size of all transactions currently waiting to be included in a block) is less than 27 kB, transactions are free. 
  If the blocksize is more than 250 kB, transactions get increasingly more expensive as the blocksize approaches the limit of 500 kB. Sending a transaction when the blocksize is 400 kB will cost 5 times the normal amount; sending when it's 499 kB will cost 500x, etc. 

https://en.bitcoin.it/wiki/Transaction_fees 
So you could make a 500KB transaction but the required minimum fee would be 5BTC.  The developers have indicated they intend to change transaction fee rules in the future but given block space is a valuable commodity any new rules are likely to be constructed to encourage (via larger fees) smaller transaction sizes.

user2306: The maximum transaction size is the size of the block. Source.
// Size limits (this doesn't take the witness into account, as that hasn't been checked for malleability)
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
    return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize");

Transactions larger than 100 kilobytes (including witness at a 75% discount rate) are non-standard. Source 1. Source 2.
static const unsigned int MAX_STANDARD_TX_WEIGHT = 400000;
...
if (sz >= MAX_STANDARD_TX_WEIGHT)
{
    LogPrint(BCLog::MEMPOOL, "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString());
    return false;
}


638: <p>I see from the source code (script.cpp) that there is an upper limit in the script size. It there any other limit to avoid a single transaction preventing other transactions of smaller sizes to get into a block?</p>

<p>How is this kind of attack prevented?</p>

<p>I've read in CTransaction::AcceptToMemoryPool the line:</p>

<pre><code>if .... ::GetSerializeSize(*this, SER_NETWORK) &lt; 100) 
    return error("..."); 
</code></pre>

<p>Does this line means that the maximum transaction size is 100 bytes?</p>
 307: <p>If there is a max transaction size it is much higher than 100 bytes. Not sure what that snippet is refering to but the average transaction is closer to ~300 bytes looking at the average # of transactions and block size for last 1000 blocks.</p>

<p>What limits transaction size is cost.  As transaction size (of all transactions awaiting next block) increases the min required fee increases non-linearly.  </p>

<blockquote>
  <p>0.01 BTC fee per kilobyte of transaction, but: 
  If the blocksize (size of all transactions currently waiting to be included in a block) is less than 27 kB, transactions are free. 
  If the blocksize is more than 250 kB, transactions get increasingly more expensive as the blocksize approaches the limit of 500 kB. Sending a transaction when the blocksize is 400 kB will cost 5 times the normal amount; sending when it's 499 kB will cost 500x, etc. </p>
</blockquote>

<p><a href="https://en.bitcoin.it/wiki/Transaction_fees">https://en.bitcoin.it/wiki/Transaction_fees</a> </p>

<p>So you could make a 500KB transaction but the required minimum fee would be 5BTC.  The developers have indicated they intend to change transaction fee rules in the future but given block space is a valuable commodity any new rules are likely to be constructed to encourage (via larger fees) smaller transaction sizes.</p>
 2306: <p>The maximum transaction size is the size of the block. <a href="https://github.com/bitcoin/bitcoin/blob/3c098a8aa0780009c11b66b1a5d488a928629ebf/src/consensus/tx_verify.cpp#L166" rel="noreferrer">Source</a>.</p>

<pre><code>// Size limits (this doesn't take the witness into account, as that hasn't been checked for malleability)
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR &gt; MAX_BLOCK_WEIGHT)
    return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize");
</code></pre>

<p>Transactions larger than 100 kilobytes (including witness at a 75% discount rate) are non-standard. <a href="https://github.com/bitcoin/bitcoin/blob/3c098a8aa0780009c11b66b1a5d488a928629ebf/src/policy/policy.h#L24" rel="noreferrer">Source 1</a>. <a href="https://github.com/bitcoin/bitcoin/blob/3c098a8aa0780009c11b66b1a5d488a928629ebf/src/net_processing.cpp#L661-L665" rel="noreferrer">Source 2</a>.</p>

<pre><code>static const unsigned int MAX_STANDARD_TX_WEIGHT = 400000;
...
if (sz &gt;= MAX_STANDARD_TX_WEIGHT)
{
    LogPrint(BCLog::MEMPOOL, "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString());
    return false;
}
</code></pre>
