Make witness v0 outputs non-standard #8381

pull jl2012 wants to merge 2 commits into bitcoin:master from jl2012:patch-15 changing 4 files +89 −7
  1. jl2012 commented at 12:14 PM on July 20, 2016: contributor

    Witness v0 outputs are unsafe before segwit is activated and should remain non-standard

  2. petertodd commented at 12:39 PM on July 20, 2016: contributor

    Did you try spending one? They can't be spent due to the CLEANSTACK rule.

  3. jl2012 commented at 12:44 PM on July 20, 2016: contributor

    @petertodd : yes, when spending it is non-standard for <= 0.12. The issue here is transactions with such outputs are relayed and mined by 0.13, even before activation of segwit

  4. instagibbs commented at 12:56 PM on July 20, 2016: member

    concept ACK

  5. petertodd commented at 1:06 PM on July 20, 2016: contributor

    @jl2012 Ah sorry, misread that. Still there's no harm to those outputs being created.

  6. instagibbs commented at 1:09 PM on July 20, 2016: member

    @petertodd miner confiscation?

  7. petertodd commented at 1:12 PM on July 20, 2016: contributor

    @instagibbs There's lots of ways you can screw up and lose your coins you know... :)

  8. jl2012 commented at 1:18 PM on July 20, 2016: contributor

    @petertodd why do we have IsStandard check for outputs at all? To prevent UTXO spam or to prevent people losing money by doing stupid things? This patch is for the latter reason.

  9. btcdrak commented at 1:20 PM on July 20, 2016: contributor

    Concept ACK

  10. petertodd commented at 2:53 PM on July 20, 2016: contributor

    eh, whatever, harmless to do this too.

    Concept ACK

  11. MarcoFalke added the label TX fees and policy on Jul 20, 2016
  12. MarcoFalke added the label Needs backport on Jul 20, 2016
  13. sipa commented at 4:19 PM on July 20, 2016: member

    utACK, though we should have an issue to revisit this for 0.13.1

  14. NicolasDorier commented at 2:56 PM on July 21, 2016: contributor

    This will not be in 0.13, and 0.13.1 will include segwit, and we don't want to require people to update to 0.13.2 for starting to relay segwit transaction, so I don't understand the reason of this PR.

  15. NicolasDorier commented at 2:59 PM on July 21, 2016: contributor

    And if it is meant for 0.13, then it means that once segwit is activated, the relay of segwit outputs will be penalized because of old 0.13 nodes.

  16. luke-jr commented at 3:03 PM on July 21, 2016: member

    Should we make this conditional on !testnet? @NicolasDorier This makes 0.13 equivalent to 0.12 in that regard.

  17. sipa commented at 3:06 PM on July 21, 2016: member

    I'd prefer to make this based on IsWitnessEnabled, so we don't need to touch that code again.

  18. NicolasDorier commented at 3:33 PM on July 21, 2016: contributor

    @luke-jr yes, but I feel it is kind of a waste, would be nice that when segwit get activated that it can be broadly relayed. Agree on using IsWitnessEnabled.

  19. instagibbs commented at 3:35 PM on July 21, 2016: member

    ok, concept NACK this in favor of IsWitnessEnabled

  20. jl2012 force-pushed on Jul 21, 2016
  21. jl2012 force-pushed on Jul 21, 2016
  22. jl2012 commented at 5:25 PM on July 21, 2016: contributor

    updated to using IsWitnessEnabled

  23. jl2012 force-pushed on Jul 21, 2016
  24. sdaftuar commented at 6:45 PM on July 21, 2016: member

    Concept ACK, will test.

  25. Make witness v0 outputs non-standard before segwit activation 1ffaff2f74
  26. in src/main.cpp:None in 3f67f310ce outdated
    1143 | @@ -1144,13 +1144,14 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
    1144 |      }
    1145 |  
    1146 |      // Reject transactions with witness before segregated witness activates (override with -prematurewitness)
    1147 | -    if (!GetBoolArg("-prematurewitness",false) && !tx.wit.IsNull() && !IsWitnessEnabled(chainActive.Tip(), Params().GetConsensus())) {
    1148 | +    bool witnessenabled = IsWitnessEnabled(chainActive.Tip(), Params().GetConsensus());
    


    dcousens commented at 6:18 AM on July 22, 2016:

    nit: s/witnessenabled/witnessEnabled would be more consistent with all other naming, no?


    jl2012 commented at 6:36 AM on July 22, 2016:

    fixed

  27. jl2012 force-pushed on Jul 22, 2016
  28. dcousens commented at 6:40 AM on July 22, 2016: contributor

    utACK 1ffaff2

  29. NicolasDorier commented at 2:51 PM on July 22, 2016: contributor

    utACK 1ffaff2f747af683513d6d74a7241d41e3f6e051

  30. sdaftuar commented at 3:18 PM on July 22, 2016: member

    Tested ACK 1ffaff2f747af683513d6d74a7241d41e3f6e051

    FYI I added a test to p2p-segwit.py to cover this case, feel free to include if you like: https://github.com/sdaftuar/bitcoin/commit/21c59eac187af8a35abc9aec87bfbf51d812a449

  31. qa: Add test for standardness of segwit v0 outputs c59c434b7d
  32. jl2012 commented at 4:03 PM on July 22, 2016: contributor

    @sdaftuar I have added your test. Thank you!

  33. laanwj commented at 12:24 PM on July 26, 2016: member

    utACK c59c434, thanks @sdaftuar for adding the test

  34. laanwj merged this on Jul 26, 2016
  35. laanwj closed this on Jul 26, 2016

  36. laanwj referenced this in commit 4b1a4d8810 on Jul 26, 2016
  37. laanwj referenced this in commit f84ee3dab6 on Jul 26, 2016
  38. laanwj referenced this in commit 4f7f531af6 on Jul 26, 2016
  39. laanwj commented at 12:26 PM on July 26, 2016: member

    Backported to 0.13 as f84ee3d 4f7f531 (used two commits instead of squashing because of separate authors)

  40. MarcoFalke removed the label Needs backport on Jul 31, 2016
  41. MarcoFalke commented at 8:10 PM on July 31, 2016: member

    @laanwj Removed the label as well.

  42. dcousens commented at 11:11 PM on July 31, 2016: contributor

    Heh, title should probably read "Make witness v0 outputs non-standard until activation".

  43. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 09:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me