aboutsummaryrefslogtreecommitdiff
path: root/src/script/standard.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright headers to 2018DrahtBot2018-07-271-1/+1
|
* Remove redundant unused variablespracticalswift2018-07-181-2/+0
|
* Add P2WSH destination helper and use it instead of manual hashingPieter Wuille2018-06-171-3/+7
|
* wallet: Prevent segfault when sending to unspendable witnessMarcoFalke2018-05-301-0/+1
|
* Remove template matching and pseudo opcodesPieter Wuille2018-05-291-87/+62
| | | | | | | | | | | | | The current code contains a rather complex script template matching engine, which is only used for 3 particular script types (P2PK, P2PKH, multisig). The first two of these are trivial to match for otherwise, and a specialized matcher for multisig is both more compact and more efficient than a generic one. The goal is being more flexible, so that for example larger standard multisigs inside SegWit outputs are more easy to implement. As a side-effect, it also gets rid of the pseudo opcodes hack.
* Extract consts for WITNESS_V0 hash sizesBen Woosley2018-04-101-2/+2
|
* Assert CPubKey::ValidLength to the pubkey's header-relevent sizeBen Woosley2018-02-161-2/+2
| | | | | | | Previously this was an inline test where the specificity was probably judged overly specific. As a class method it makes sense to maintain consistency. And replace some magic values with their constant equivalents.
* Merge #11403: SegWit wallet supportJonas Schnelli2018-01-101-8/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | b224a47a1 Add address_types test (Pieter Wuille) 7ee54fd7c Support downgrading after recovered keypool witness keys (Pieter Wuille) 940a21932 SegWit wallet support (Pieter Wuille) f37c64e47 Implicitly know about P2WPKH redeemscripts (Pieter Wuille) 57273f2b3 [test] Serialize CTransaction with witness by default (Pieter Wuille) cf2c0b6f5 Support P2WPKH and P2SH-P2WPKH in dumpprivkey (Pieter Wuille) 37c03d3e0 Support P2WPKH addresses in create/addmultisig (Pieter Wuille) 3eaa003c8 Extend validateaddress information for P2SH-embedded witness (Pieter Wuille) 30a27dc5b Expose method to find key for a single-key destination (Pieter Wuille) 985c79552 Improve witness destination types and use them more (Pieter Wuille) cbe197470 [refactor] GetAccount{PubKey,Address} -> GetAccountDestination (Pieter Wuille) 0c8ea6380 Abstract out IsSolvable from Witnessifier (Pieter Wuille) Pull request description: This implements a minimum viable implementation of SegWit wallet support, based on top of #11389, and includes part of the functionality from #11089. Two new configuration options are added: * `-addresstype`, with options `legacy`, `p2sh`, and `bech32`. It controls what kind of addresses are produced by `getnewaddress`, `getaccountaddress`, and `createmultisigaddress`. * `-changetype`, with the same options, and by default equal to `-addresstype`, that controls what kind of change is used. All wallet private and public keys can be used for any type of address. Support for address types dependent on different derivation paths will need a major overhaul of how our internal detection of outputs work. I expect that that will happen for a next major version. The above also applies to imported keys, as having a distinction there but not for normal operations is a disaster for testing, and probably for comprehension of users. This has some ugly effects, like needing to associate the provided label to `importprivkey` with each style address for the corresponding key. To deal with witness outputs requiring a corresponding redeemscript in wallet, three approaches are used: * All SegWit addresses created through `getnewaddress` or multisig RPCs explicitly get their redeemscripts added to the wallet file. This means that downgrading after creating a witness address will work, as long as the wallet file is up to date. * All SegWit keys in the wallet get an _implicit_ redeemscript added, without it being written to the file. This means recovery of an old backup will work, as long as you use new software. * All keypool keys that are seen used in transactions explicitly get their redeemscripts added to the wallet files. This means that downgrading after recovering from a backup that includes a witness address will work. These approaches correspond to solutions 3a, 1a, and 5a respectively from https://gist.github.com/sipa/125cfa1615946d0c3f3eec2ad7f250a2. As argued there, there is no full solution for dealing with the case where you both downgrade and restore a backup, so that's also not implemented. `dumpwallet`, `importwallet`, `importmulti`, `signmessage` and `verifymessage` don't work with SegWit addresses yet. They're remaining TODOs, for this PR or a follow-up. Because of that, several tests unexpectedly run with `-addresstype=legacy` for now. Tree-SHA512: d425dbe517c0422061ab8dacdc3a6ae47da071450932ed992c79559d922dff7b2574a31a8c94feccd3761c1dffb6422c50055e6dca8e3cf94a169bc95e39e959
| * Improve witness destination types and use them morePieter Wuille2018-01-031-8/+3
| |
* | Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa2018-01-031-1/+1
|/
* scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider2017-11-161-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
* Implement BIP173 addresses and testsPieter Wuille2017-09-281-0/+45
|
* Introduce wrappers around CBitcoinAddressPieter Wuille2017-09-061-0/+4
| | | | | | | This patch removes the need for the intermediary Base58 type CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination function that directly operate on the conversion between strings and CTxDestination.
* Comments: More comments on functions/globals in standard.h.Jim Posen2017-08-181-3/+0
|
* Declare single-argument (non-converting) constructors "explicit"practicalswift2017-08-161-1/+1
| | | | In order to avoid unintended implicit conversions.
* scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift2017-08-071-1/+1
| | | | | | | | | | | | | instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
* Merge #10193: scripted-diff: Remove #include <boost/foreach.hpp>Wladimir J. van der Laan2017-07-041-1/+0
|\ | | | | | | | | | | | | | | | | | | b1268a1 clang-format: Delete ForEachMacros (Jorge Timón) 5995735 scripted-diff: Remove #include <boost/foreach.hpp> (Jorge Timón) 3eff827 scripted-diff: Remove BOOST_REVERSE_FOREACH (Jorge Timón) 33aed5b Fix const_reverse_iterator constructor (pass const ptr) (Jorge Timón) 300851e Introduce src/reverse_iterator.hpp and include it... (Jorge Timón) Tree-SHA512: df3405328e9602d0a433ac134ba59a5c9a6202ef64188df2f94a59b2ce58dec7c988b25d0671c7937de516a96b2e6daeb9d04c82fa363b616ee4cf6e9cb0fac6
| * scripted-diff: Remove #include <boost/foreach.hpp>Jorge Timón2017-06-221-1/+0
| | | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i ':a;N;$!ba;s/#include <boost\/foreach.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp -END VERIFY SCRIPT-
* | Merge #9544: [trivial] Add end of namespace comments. Improve consistency.Wladimir J. van der Laan2017-06-261-1/+1
|\ \ | |/ |/| | | | | | | 5a9b508 [trivial] Add end of namespace comments (practicalswift) Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
| * [trivial] Add end of namespace commentspracticalswift2017-05-311-1/+1
| |
* | scripted-diff: Remove PAIRTYPEJorge Timón2017-06-051-1/+1
| | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i 's/PAIRTYPE(\([^,]*\), \([^\)]*\))/std::pair<\1, \2>/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ; sed -i ':a;N;$!ba;s/#define std::pair<t1, t2> std::pair<t1, t2>\n//' ./src/utilstrencodings.h ; -END VERIFY SCRIPT-
* | scripted-diff: Fully remove BOOST_FOREACHJorge Timón2017-06-051-2/+2
|/ | | | | | -BEGIN VERIFY SCRIPT- sed -i 's/BOOST_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ; -END VERIFY SCRIPT-
* Refactor: Remove using namespace <xxx> from script/Karl-Johan Alm2017-03-081-13/+11
|
* Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
| | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* BIP143: Signing logicPieter Wuille2016-06-221-0/+41
|
* Get rid of inaccurate ScriptSigArgsExpectedPieter Wuille2016-02-011-21/+0
| | | | (cherry picked from commit 52b29dca7670c3f6d2ab918c0fff1d17c4e494ad)
* Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|
* [trivial] Reuse translation and cleanup DEFAULT_* valuesMarcoFalke2015-11-281-1/+1
| | | | | * DEFAULT_DISABLE_SAFEMODE = false * Use DEFAULT_* constants for extern bools
* Constrain constant values to a single location in codeLuke Dashjr2015-11-281-0/+1
|
* Accept any sequence of PUSHDATAs in OP_RETURN outputsPeter Todd2015-10-011-11/+10
| | | | | | | | | | | | 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!)
* Make TX_SCRIPTHASH clear vSolutionsRet firstPeter Todd2015-10-011-0/+2
| | | | | | | 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.
* Also remove pay-2-pubkey from watch when adding a priv keyMatt Corallo2015-07-201-0/+5
|
* Policy: MOVEONLY: 3 functions to policy.o:Luke Dashjr2015-06-261-20/+0
| | | | | | | | - [script/standard.o] IsStandard - [main.o] IsStandardTx - [main.o] AreInputsStandard Also, don't use namespace std in policy.cpp
* Fix CScriptID(const CScript& in) in empty script casePeter Todd2014-12-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | Previously an empty script wouldn't be hashed, and CScriptID would be assigned the incorrect value of 0 instead. This bug can be seen in the RPC decodescript command: $ btc decodescript "" { "asm" : "", "type" : "nonstandard", "p2sh" : "31h1vYVSYuKP6AhS86fbRdMw9XHieotbST" } Correct output: $ btc decodescript "" { "asm" : "", "type" : "nonstandard", "p2sh" : "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy" }
* Added "Core" to copyright headerssandakersmann2014-12-191-1/+1
| | | | | Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
* Make comments in /src/script doxygen compatibleMichael Ford2014-11-101-3/+3
|
* Merge pull request #5162Wladimir J. van der Laan2014-11-041-0/+1
|\ | | | | | | | | | | d2e74c5 boost: moveonly: split CPubKey and friends to new files (Cory Fields) 78c228c boost: moveonly: move BIP32Hash to hash.h (Cory Fields) 900078a boost: moveonly: create eccryptoverify.h|cpp and move helper functions there (Cory Fields)
| * boost: moveonly: split CPubKey and friends to new filesCory Fields2014-10-311-0/+1
| |
* | Enable customising node policy for datacarrier data size with a ↵Luke Dashjr2014-10-271-2/+4
|/ | | | -datacarriersize option
* script: add a slew of includes all around and drop includes from script.hCory Fields2014-10-171-0/+1
| | | | Lots of files ended up with indirect includes from script.h.
* script: add ToByteVector() for converting anything with begin/endCory Fields2014-10-171-3/+3
| | | | This should move to a util header once their dependencies are cleaned up.
* script: move CScriptID to standard.h and add a ctor for creating them from ↵Cory Fields2014-10-171-0/+2
| | | | | | | | | | | | | | | | CScripts This allows for a reversal of the current behavior. This: CScript foo; CScriptID bar(foo.GetID()); Becomes: CScript foo; CScriptID bar(foo); This way, CScript is no longer dependent on CScriptID or Hash();
* Don't return an address for invalid pubkeysAndy Alness2014-10-061-2/+13
|
* Move CTxDestination from script/script to script/standardPieter Wuille2014-09-161-0/+47
|
* cleanup new script files (no code changes)Philip Kaufmann2014-09-141-2/+2
| | | | | | - add missing header end comments - ensure alphabetical ordering - update copyright year and license
* Separate script/standardjtimon2014-09-081-0/+254