As of block 597,379 txcount is 460,596,047 (see chainparams.cpp
), while uint32
can handle up to 4,294,967,296.
Pre segwit the minimum transaction size was 166 bytes, so the worst case number of transactions per block was ~6000. As the original source comment for unsigned int nChainTx
says, that should last until the year 2030.
With SegWit the smallest possible transaction is 60 bytes (potentially increased to 65 with a future soft fork, see #15482), without a witness:
04 bytes version
1 1 byte input count
2 36 bytes outpoint
3 1 byte scriptSigLen (0x00)
4 0 bytes scriptSig
5 4 bytes sequence
6 1 byte output count
7 8 bytes value
8 1 byte scriptPubKeyLen
9 1 byte scriptPubKey (OP_TRUE)
10 4 bytes locktime
That puts the maximum number of transactions per block at 16,666 so we might have to deal with this as early as a block 827,450 in early 2024.
Given that it’s a memory-only thing and we want to allow users many years to upgrade, I would suggest fixing this in v0.20 and back-porting it.