Skip to content

Instantly share code, notes, and snippets.

@sdaftuar
Last active June 14, 2016 16:03
Show Gist options
  • Save sdaftuar/0469a2583f33989cf8196d2f26d99114 to your computer and use it in GitHub Desktop.
Save sdaftuar/0469a2583f33989cf8196d2f26d99114 to your computer and use it in GitHub Desktop.
Segwit notes

Tests to be written:

  • bitcoin-tx (signature covers amount, signing for P2SH wrapped witness, witness pkh)
  • bitcoinconsensus (additional unit tests, eg amount under value, verify that all error codes are exercised, etc) - [x] Tests for amount under value are done in https://github.com/sdaftuar/bitcoin/tree/segwit-script-tests
  • addrman testing for new service bit storage, preferential peering, other behavior changes?
  • update p2p-segwit.py to test block relay from unupgraded peers (Done by instagibbs!)
  • are we testing amount under value in transaction signature cache unit tests? Yes -- segwit.py and p2p-segwit.py both fail if we break CachingTransactionSignatureChecker
  • figure out which RPCs have changed, and test them all. (getblock: size/strippedsize, getrawtransaction: wtxid("hash")/txinwitness, signrawtransaction - support for P2WSH, P2SH wrapped witness program, witness PKH), addwitnessaddress, createwitnessaddress
  • Test sigops/byte restriction in AcceptToMemoryPoolWorker. Giving up on this, due to lack of any stated reasoning for the prior limits, and the new code seems reasonable assuming the original behavior was reasonable.
  • Add unit tests for GetTransactionSigOpCost (Done by jonasnick!)
  • Test that getblocktemplate clears segwit version bit if client hasn't indicated support.
    Waiting for #7935 and related changes...
  • Test that the changes to core_memusage are correct (what is best way to do this?)
  • Wallet: need to tested all the ways of signing (P2SH wrapped witness, witness PKH, P2WSH?) unit tests should be reviewed, also update rpc test to actually sign all the kinds of segwit transactions (breaking nValue didn't cause any tests to fail)
  • Why is pruning.py failing on #7910??

    This is because blockmaxcost defaults to 3M, while the test tries to increase the size of mined blocks to nearly 1MB. with no witness transactions, the default blockmaxcost limits the size of generated blocks to ~750kb, which breaks the test.

    Suggested fix: set default blockmaxcost to 4M so that pre-activation, miners can continue to use -blockmaxsize to set the size of mined blocks.

  • Add P2P test for MSG_FILTERED_BLOCK (block & tx response, see below)

Bug fixes:

  • core_memusage.h : missing call to RecursiveDynamicUsage for witness in CTransaction.
  • main.cpp:4751 : should specify whether to include witnesses for tx included in response to FILTERED_BLOCK request

gmaxwell general review area concern:

  • how are we handling misbehaving peers (don't send witness data, corrupted data, etc)?

Other todo's:

  • Mining: work out how GBT will work (non-segwit aware software shouldn't be able to signal segwit's version bit); see #7935 for some context of how we'll likely implement
  • Seed nodes for segwit - being worked on by jonasschnelli
  • Add documentation to release notes describing -blockmaxsize as a transition option not guaranteed to produce optimal blocks (post-activation). CreateNewBlock will be optimized for virtual-size-based-feerate, not raw-size-based-feerate. ...
@instagibbs
Copy link

update p2p-segwit.py to test block relay from unupgraded peers

https://github.com/sipa/bitcoin/pull/91/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment