I guess the same could be said about the softfork flavoured SW implementation. In any case, the strategy pattern helps with code structure in situations like this. 2015-12-30 14:29 GMT+01:00 Jonathan Toomim via bitcoin-dev < bitcoin-dev@lists.linuxfoundation.org>: > As a first impression, I think this proposal is intellectually > interesting, but crufty and hackish and should never actually be deployed. > Writing code for Bitcoin in a future in which we have deployed a few > generalized softforks this way sounds terrifying. > > Instead of this: > > CTransaction GetTransaction(CBlock block, unsigned int index) { > return block->vtx[index]; > } > > We might have this: > > CTransaction GetTransaction(CBlock block, unsigned int index) { > if (!IsBIP102sBlock(block)) { > return block->vtx[index]; > } else { > if (!IsOtherGeneralizedSoftforkBlock(block)) { > // hooray! only one generalized softfork level to deal > with! > return > LookupBlock(GetGSHashFromCoinbase(block->vtx[0].vin[0].scriptSig))->vtx[index]; > } else { > throw NotImplementedError; // I'm too lazy to write > pseudocode this complicated just to argue a point > } > } > > It might be possible to make that a bit simpler with recursion, or by > doing subsequent generalized softforks in a way that doesn't have > multi-levels-deep block-within-a-block-within-a-block stuff. Still: ugh. > > > > > On Dec 29, 2015, at 9:46 PM, joe2015--- via bitcoin-dev < > bitcoin-dev@lists.linuxfoundation.org> wrote: > > > Below is a proof-of-concept implementation of BIP102 as a softfork: > > > > https://github.com/ZoomT/bitcoin/tree/2015_2mb_blocksize > > > https://github.com/jgarzik/bitcoin/compare/2015_2mb_blocksize...ZoomT:2015_2mb_blocksize?diff=split&name=2015_2mb_blocksize > > > > BIP102 is normally a hardfork. The softfork version (unofficial > > codename BIP102s) uses the idea described here: > > > http://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-December/012073.html > > > > The basic idea is that post-fork blocks are constructed in such a way > > they can be mapped to valid blocks under the pre-fork rules. BIP102s > > is a softfork in the sense that post-fork miners are still creating a > > valid chain under the old rules, albeit indirectly. > > > > From the POV of non-upgraded clients, BIP102s circumvents the > > block-size limit by moving transaction validation data "outside" of > > the block. This is a similar trick used by Segregated Witness and > > Extension Blocks (both softfork proposals). > > > > From the POV of upgraded clients, the block layout is unchanged, > > except: > > - A larger 2MB block-size limit (=BIP102); > > - The header Merkle root has a new (backwards compatible) > > interpretation; > > - The coinbase encodes the Merkle root of the remaining txs. > > Aside from this, blocks maintain their original format, i.e. a block > > header followed by a vector of transactions. This keeps the > > implementation simple, and is distinct from SW and EB. > > > > Since BIP102s is a softfork it means that: > > - A miner majority (e.g. 75%, 95%) force miner consensus (100%). This > > is not true for a hardfork. > > - Fraud risk is significantly reduced (6-conf unlikely depending on > > activation threshold). > > This should address some of the concerns with deploying a block-size > > increase using a hardfork. > > > > Notes: > > > > - The same basic idea could be adapted to any of the other proposals > > (BIP101, 2-4-8, BIP202, etc.). > > - I used Jeff Garzik's BIP102 implementation which is incomplete (?). > > The activation logic is left unchanged. > > - I am not a Bitcoin dev so hopefully no embarrassing mistakes in my > > code :-( > > > > --joe > > > > _______________________________________________ > > bitcoin-dev mailing list > > bitcoin-dev@lists.linuxfoundation.org > > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev > > > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev > >