New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[0.12] Backport BIP9, BIP68 and BIP112 with softfork #7543
Conversation
ACK on this being the correct backport, but I would prefer to see 1 pull with the soft fork logic and all accompanying implementations backported at the same time. I think it would be much safer to test and review it together like that. Lets wait until we have the soft fork logic finished and merged. |
I added #7187 to this backport. |
d20393d
to
d110b32
Compare
SequenceLocks functions are used to evaluate sequence lock times or heights per BIP 68. The majority of this code is copied from maaku in bitcoin#6312 Further credit: btcdrak, sipa, NicolasDorier
it boggles the mind why these nits can't be delivered on a more timely basis
- Replace NOP3 with CHECKSEQUENCEVERIFY (BIP112) <nSequence> CHECKSEQUENCEVERIFY -> <nSequence> - Fails if txin.nSequence < nSequence, allowing funds of a txout to be locked for a number of blocks or a duration of time after its inclusion in a block. - Pull most of CheckLockTime() out into VerifyLockTime(), a local function that will be reused for CheckSequence() - Add bitwise AND operator to CScriptNum - Enable CHECKSEQUENCEVERIFY as a standard script verify flag - Transactions that fail CSV verification will be rejected from the mempool, making it easy to test the feature. However blocks containing "invalid" CSV-using transactions will still be accepted; this is *not* the soft-fork required to actually enable CSV for production use.
For the sake of a little repetition, make code more readable.
This if statement is a little obtuse and using braces here improves readability.
Obtain LockPoints to store in CTxMemPoolEntry and during a reorg, evaluate whether they are still valid and if not, recalculate them.
Inspired by former implementations by Eric Lombrozo and Rusty Russell, and based on code by Jorge Timon.
d110b32
to
6ff0b9f
Compare
This commit introduces a way to gracefully bump the default transaction version in a two step process.
This RPC test will test both the activation mechanism of the first versionbits soft fork as well as testing many code branches of the consensus logic for BIP's 68, 112, and 113.
ACK |
3afee6d
to
26e9a05
Compare
Mechanical backport check ACK 26e9a05 Ran the following script:
with input: (the corresponding non-test commits) The output is:
which is good, as there are no lines starting with '+' or '-' that changed between the diffs. |
26e9a05 ACK, backport matches |
ACK caf1381 |
backport matches, tACK caf1381 |
utACK |
self.height = 3 # height of the next block to build | ||
self.tip = int ("0x" + self.nodes[0].getbestblockhash() + "L", 0) | ||
self.nodeaddress = self.nodes[0].getnewaddress() | ||
self.last_block_time = time.time() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should explicitly be int. Sadly, py2 will silently cast the float to int where needed.
utACK c270b62. My nits can be fixed later |
utACK, checked with sipa's script |
@@ -181,7 +181,7 @@ def test_sequence_lock_confirmed_inputs(self): | |||
value += utxos[j]["amount"]*COIN | |||
# Overestimate the size of the tx - signatures should be less than 120 bytes, and leave 50 for the output | |||
tx_size = len(ToHex(tx))/2 + 120*num_inputs + 50 | |||
tx.vout.append(CTxOut(value-self.relayfee*tx_size*COIN/1000, CScript([b'a']))) | |||
tx.vout.append(int(CTxOut(value-self.relayfee*tx_size*COIN/1000, CScript([b'a'])))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be surprised if this worked. (You are passing the CTxOut into int())
Edit: You could just try a git cherry-pick ...; git reset HEAD~; git commit qa/rpc-tests/bip*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
partial backport from bitcoin#7778 using fa2cea1
94c68e1
to
640666b
Compare
@MarcoFalke I cherry-picked your int/float fixes for RPC tests, from #7778 commit fa2cea1 in 640666b |
utACK 640666b |
640666b [qa] rpc-tests: Properly use integers, floats (BtcDrak) c270b62 Fix comments in tests (BtcDrak) caf1381 Add bip68-sequence.py to extended rpc tests (BtcDrak) 26e9a05 Test of BIP9 fork activation of mtp, csv, sequence_lock (NicolasDorier) 3a99feb Add RPC test for BIP 68/112/113 soft fork. (Alex Morcos) 159ee3d Policy: allow transaction version 2 relay policy. (BtcDrak) 9713ed3 Soft fork logic for BIP68 (BtcDrak) 648be9b Soft fork logic for BIP113 (BtcDrak) ee40924 Add CHECKSEQUENCEVERIFY softfork through BIP9 (Pieter Wuille) 6ff0b9f RPC test for BIP9 warning logic (Suhas Daftuar) 0710b30 Test versionbits deployments (Suhas Daftuar) 8ebc6f2 Add testing of ComputeBlockVersion (Suhas Daftuar) 0bdaacd Softfork status report in RPC (Pieter Wuille) 5f90d4e Versionbits tests (Pieter Wuille) 6f83cf2 BIP9 Implementation (Pieter Wuille) ade85e1 Add LockPoints (Alex Morcos) c8d309e Code style fix. (BtcDrak) 6170506 Separate CheckLockTime() and CheckSequence() logic (BtcDrak) c0c5e09 BIP112: Implement CHECKSEQUENCEVERIFY (Mark Friedenbach) 197c376 fix sdaftuar's nits again (Alex Morcos) 0a79c04 Bug fix to RPC test (Alex Morcos) 0d09af7 Add RPC test exercising BIP68 (mempool only) (Suhas Daftuar) 15ba08c Implement SequenceLocks functions (Alex Morcos)
ACK 3a99feb |
Backport of #7184 (BIP68), #7524 (BIP112), #7187 (lockpoints), #7575 (BIP9) and #7648 (softfork) for 0.12.
EDIT: added #7531 (one line add test to extendedTests array and trivial comment edit #7773