Johnson Lau
387ec9d963
Add script tests for FindAndDelete in pre-segwit and segwit scripts
...
Github-Pull: #8927
Rebased-From: acf853df910339412bafb1743f42af1774f5b910
2016-12-02 07:56:12 +00:00
Pieter Wuille
4ec21e8a64
Fix ismine and addwitnessaddress: no uncompressed keys in segwit
...
Github-Pull: #8499
Rebased-From: 248f3a76a825a332e5495c5947ad283a9e5e938f
2016-10-17 14:10:59 +02:00
Johnson Lau
821f3e6751
Require compressed keys in segwit as policy and disable signing with uncompressed keys for segwit scripts
...
Github-Pull: #8499
Rebased-From: 4c0c25a604cec39675187507df423cff5d707ab5
2016-10-17 14:10:58 +02:00
Johnson Lau
7a34a4614c
Add NULLDUMMY verify flag in bitcoinconsensus.h
...
Github-Pull: #8848
Rebased-From: 2fa0063c26c80c719a1c0d30e548e338689ac917
2016-10-13 20:09:31 +02:00
Johnson Lau
3e80ab7f2a
Add policy: null signature for failed CHECK(MULTI)SIG
...
Github-Pull: #8634
Rebased-From: e41bd449ab2b8d01260795383af2c40b659d8587
2016-10-13 20:01:46 +02:00
Johnson Lau
0027672c80
Make non-minimal OP_IF/NOTIF argument non-standard for P2WSH
...
Github-Pull: #8526
Rebased-From: c72c5b1e3bd42e84465677e94aa83316ff3d9a14
2016-10-13 20:01:45 +02:00
MarcoFalke
486650ae6a
[doc] Fix typos in comments, doxygen: Fix comment syntax
...
Github-Pull: #8607
Rebased-From: fa27c0a2c4545a579bf339e816c3fa785252b7dc
2016-09-21 02:43:47 +00:00
Pieter Wuille
b8c79a057c
Precompute sighashes
...
Original version by Nicolas Dorier. Precomputing version by Pieter Wuille.
2016-09-07 16:42:41 +02:00
Jorge Timón
8360d5b37d
libconsensus: Expose a flag for BIP112
...
We added the segwit one, but we forgot CHECKSEQUENCEVERIFY
Github-Pull: #8412
Rebased-From: d12b732ac287a1ed7543481b79801c9afc333b7f
2016-07-29 01:16:57 +02:00
BtcDrak
14d01309be
Rename OP_NOP3 to OP_CHECKSEQUENCEVERIFY
2016-06-28 17:17:36 +01:00
NicolasDorier
745eb678ef
[RPC] signrawtransaction can sign P2WSH
2016-06-22 15:43:01 +02:00
Pieter Wuille
605e8473a7
BIP143: Signing logic
2016-06-22 15:43:01 +02:00
Thomas Kerin
b7dbeb24eb
[libconsensus] Script verification API with amounts
...
script_tests: always test bitcoinconsensus_verify_script_with_amount if VERIFY_WITNESS isn't set
Rename internal method + make it static
trim bitcoinconsensus_ prefix
Add SERIALIZE_TRANSACTION_WITNESS flag
2016-06-22 15:43:00 +02:00
Pieter Wuille
2b1f6f9ccf
BIP141: Other consensus critical limits, and BIP145
...
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
2016-06-22 15:43:00 +02:00
Pieter Wuille
3dd410294d
BIP143: Verification logic
...
Includes simplifications by Eric Lombrozo.
2016-06-22 15:43:00 +02:00
Pieter Wuille
0ef1dd3e11
Refactor script validation to observe amounts
...
This is a preparation for BIP143 support.
2016-06-22 15:43:00 +02:00
Pieter Wuille
449f9b8deb
BIP141: Witness program
2016-06-22 15:42:59 +02:00
Pieter Wuille
7030d9eb47
BIP144: Serialization, hashes, relay (sender side)
...
Contains refactorings by Eric Lombrozo.
Contains fixup by Nicolas Dorier.
Contains cleanup of CInv::GetCommand by Alex Morcos
2016-06-22 15:42:59 +02:00
Wladimir J. van der Laan
006cdf64dc
Merge #7907 : Optimize and Cleanup CScript::FindAndDelete
...
d1d7775 Improve worst-case behavior of CScript::FindAndDelete (Patrick Strateman)
e2a30bc Unit test for CScript::FindAndDelete (Gavin Andresen)
c0f660c Replace c-style cast with c++ style static_cast. (Patrick Strateman)
ec9ad5f Replace memcmp with std::equal in CScript::FindAndDelete (Patrick Strateman)
2016-05-05 19:01:32 +02:00
Pieter Wuille
4f87af6fc7
Treat overly long scriptPubKeys as unspendable
2016-04-25 14:22:30 +02:00
Pieter Wuille
f8e6fb1800
Introduce constant for maximum CScript length
2016-04-25 14:22:30 +02:00
Patrick Strateman
d1d7775587
Improve worst-case behavior of CScript::FindAndDelete
...
Thanks to Sergio Lerner for identifying this issue and suggesting this kind of solution.
2016-04-21 17:24:36 -07:00
Patrick Strateman
c0f660c3a3
Replace c-style cast with c++ style static_cast.
2016-04-19 13:22:20 -07:00
Patrick Strateman
ec9ad5f199
Replace memcmp with std::equal in CScript::FindAndDelete
...
Function is stl; std::equal just makes more sense.
2016-04-19 13:22:03 -07:00
Wladimir J. van der Laan
a25a4f5b04
wallet_ismine.h → script/ismine.h
...
Removes conditional dependency of `src/test` on wallet.
Makes multisig and P2SH tests complete without wallet built-in.
2016-04-18 15:14:36 +02:00
MarcoFalke
fada0c422c
[doc] Fix doxygen comments for members
2016-04-03 11:58:01 +02:00
BtcDrak
a38107643f
Code style fix.
...
This if statement is a little obtuse and using braces here
improves readability.
2016-02-16 09:39:44 +00:00
BtcDrak
c3c375226e
Separate CheckLockTime() and CheckSequence() logic
...
For the sake of a little repetition, make code more readable.
2016-02-14 11:29:40 +00:00
Mark Friedenbach
53e53a33c9
BIP112: Implement CHECKSEQUENCEVERIFY
...
- 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.
2016-02-14 11:29:38 +00:00
Wladimir J. van der Laan
80d1f2e483
Merge #7184 : Implement SequenceLocks functions for BIP 68
...
b043c4b fix sdaftuar's nits again (Alex Morcos)
a51c79b Bug fix to RPC test (Alex Morcos)
da6ad5f Add RPC test exercising BIP68 (mempool only) (Suhas Daftuar)
c6c2f0f Implement SequenceLocks functions (Alex Morcos)
2016-02-12 17:03:46 +01:00
Alex Morcos
c6c2f0fd78
Implement SequenceLocks functions
...
SequenceLocks functions are used to evaluate sequence lock times or heights per BIP 68.
The majority of this code is copied from maaku in #6312
Further credit: btcdrak, sipa, NicolasDorier
2016-02-10 15:35:33 -05:00
Pieter Wuille
9d95187d5d
Correctly report high-S violations
2016-02-10 14:19:20 +01:00
Pieter Wuille
5d743099b5
Get rid of inaccurate ScriptSigArgsExpected
...
(cherry picked from commit 52b29dca76 )
2016-02-01 15:28:25 +01:00
Wladimir J. van der Laan
605c17844e
Merge pull request #7205
...
fa71669 [devtools] Use git pretty-format for year parsing (MarcoFalke)
fa24439 Bump copyright headers to 2015 (MarcoFalke)
fa6ad85 [devtools] Rewrite fix-copyright-headers.py (MarcoFalke)
2016-01-05 14:11:40 +01:00
mb300sd
37d271d7cc
Rename OP_NOP2 to OP_CHECKLOCKTIMEVERIFY.
2015-12-15 02:01:45 -05:00
MarcoFalke
fa24439ff3
Bump copyright headers to 2015
2015-12-13 18:08:39 +01:00
Wladimir J. van der Laan
327291af02
Merge pull request #6914
...
114b581 Prevector type (Pieter Wuille)
2015-12-01 10:22:14 +01:00
MarcoFalke
faf93f37fe
[trivial] Reuse translation and cleanup DEFAULT_* values
...
* DEFAULT_DISABLE_SAFEMODE = false
* Use DEFAULT_* constants for extern bools
2015-11-28 19:01:11 +01:00
Luke Dashjr
b966aa836a
Constrain constant values to a single location in code
2015-11-28 18:47:29 +01:00
Pieter Wuille
6e18268616
Switch to libsecp256k1-based validation for ECDSA
2015-11-15 16:06:57 +01:00
Pieter Wuille
114b5812f6
Prevector type
2015-11-13 18:15:20 +01:00
Pieter Wuille
0b9e9dca4e
Evict sigcache entries that are seen in a block
2015-10-31 01:15:11 +01:00
Pieter Wuille
830e3f3d02
Make sigcache faster and more efficient
2015-10-31 01:15:11 +01:00
Wladimir J. van der Laan
2a1090d4f5
Merge pull request #6351
...
65ef372 Add BIP65 to getblockchaininfo softforks list (Peter Todd)
cde7ab2 Add RPC tests for the CHECKLOCKTIMEVERIFY (BIP65) soft-fork (Peter Todd)
287f54f Add CHECKLOCKTIMEVERIFY (BIP65) soft-fork logic (Peter Todd)
2015-10-23 13:33:13 +02:00
David Hill
b48da5c189
script: Remove magic numbers
...
This adds two new constants, MAX_OPS_PER_SCRIPT and
MAX_PUBKEYS_PER_MULTISIG.
2015-10-15 09:48:15 -04:00
Peter Todd
287f54fc90
Add CHECKLOCKTIMEVERIFY (BIP65) soft-fork logic
...
Based on the earlier BIP66 soft-fork logic implemented by Pieter
Wuille's 5a47811da5
2015-10-08 17:23:22 +02:00
Peter Todd
da894ab5da
Accept any sequence of PUSHDATAs in OP_RETURN outputs
...
Previously only one PUSHDATA was allowed, needlessly limiting
applications such as matching OP_RETURN contents with bloom filters that
operate on a per-PUSHDATA level. Now any combination that passes
IsPushOnly() is allowed, so long as the total size of the scriptPubKey
is less than 42 bytes. (unchanged modulo non-minimal PUSHDATA encodings)
Also, this fixes the odd bug where previously the PUSHDATA could be
replaced by any single opcode, even sigops consuming opcodes such as
CHECKMULTISIG. (20 sigops!)
2015-10-01 18:28:13 +02:00
Peter Todd
5d8709c3b7
Add IsPushOnly(const_iterator pc)
...
Allows IsPushOnly() to be applied to just part of the script for
OP_RETURN outputs.
2015-10-01 18:28:11 +02:00
Peter Todd
6a07eb676a
Make TX_SCRIPTHASH clear vSolutionsRet first
...
Previously unlike other transaction types the TX_SCRIPTHASH would not
clear vSolutionsRet, which means that unlike other transaction types if
it was called twice in a row you would get the result of the previous
invocation as well.
2015-10-01 18:27:22 +02:00
Wladimir J. van der Laan
48efbdbe98
Merge pull request #5264
...
af3208b Resolve issue 3166. These changes decode valid SIGHASH types on signatures in assembly (asm) representations of scriptSig scripts. This squashed commit incorporates substantial helpful feedback from jtimon, laanwj, and sipa. (mruddy)
2015-09-25 19:19:07 +02:00