diff options
author | W. J. van der Laan <laanwj@protonmail.com> | 2021-10-20 15:52:03 +0200 |
---|---|---|
committer | W. J. van der Laan <laanwj@protonmail.com> | 2021-10-20 15:52:08 +0200 |
commit | c8e68b418fcb62e853214e0a0df8bb860c38699c (patch) | |
tree | f4fdecf53db97872b3ab6e4c02287d5228a6a0fe | |
parent | f9ad4d51e3dbb84036762f5a9e0c6d712e49d1be (diff) | |
parent | ef72e9bd4124645fe2d00521a71c1c298d760225 (diff) | |
download | bitcoin-c8e68b418fcb62e853214e0a0df8bb860c38699c.tar.xz |
Merge bitcoin/bitcoin#13875: [doc] nChainTx needs to become a 64-bit earlier due to SegWit
ef72e9bd4124645fe2d00521a71c1c298d760225 doc: nChainTx needs to become a 64-bit earlier due to SegWit (Sjors Provoost)
Pull request description:
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](https://en.bitcoin.it/wiki/Maximum_transaction_rate) 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:
```
4 bytes version
1 byte input count
36 bytes outpoint
1 byte scriptSigLen (0x00)
0 bytes scriptSig
4 bytes sequence
1 byte output count
8 bytes value
1 byte scriptPubKeyLen
1 byte scriptPubKey (OP_TRUE)
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.
ACKs for top commit:
practicalswift:
re-ACK ef72e9bd4124645fe2d00521a71c1c298d760225
jarolrod:
ACK ef72e9bd4124645fe2d00521a71c1c298d760225
theStack:
ACK ef72e9bd4124645fe2d00521a71c1c298d760225
Tree-SHA512: d8509ba7641796cd82af156354ff3a12ff7ec0f7b11215edff6696e95f8ca0e3596f719f3492ac3acb4b0884ac4e5bddc76f107b656bc2ed95a8ef1b2b5d4f71
-rw-r--r-- | src/chain.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/chain.h b/src/chain.h index 365a7f79b6..15ca8f8750 100644 --- a/src/chain.h +++ b/src/chain.h @@ -178,7 +178,7 @@ public: //! (memory only) Number of transactions in the chain up to and including this block. //! This value will be non-zero only if and only if transactions for this block and all its parents are available. - //! Change to 64-bit type when necessary; won't happen before 2030 + //! Change to 64-bit type before 2024 (assuming worst case of 60 byte transactions). //! //! Note: this value is faked during use of a UTXO snapshot because we don't //! have the underlying block data available during snapshot load. |