Changeset View
Changeset View
Standalone View
Standalone View
src/script/sigencoding.cpp
Show All 9 Lines | |||||
#include "script_flags.h" | #include "script_flags.h" | ||||
#include <boost/range/adaptor/sliced.hpp> | #include <boost/range/adaptor/sliced.hpp> | ||||
typedef boost::sliced_range<const valtype> slicedvaltype; | typedef boost::sliced_range<const valtype> slicedvaltype; | ||||
/** | /** | ||||
* A canonical signature exists of: <30> <total len> <02> <len R> <R> <02> <len | * A canonical signature exists of: <30> <total len> <02> <len R> <R> <02> <len | ||||
* S> <S> <hashtype>, where R and S are not negative (their first byte has its | * S> <S>, where R and S are not negative (their first byte has its highest bit | ||||
* highest bit not set), and not excessively padded (do not start with a 0 byte, | * not set), and not excessively padded (do not start with a 0 byte, unless an | ||||
* unless an otherwise negative number follows, in which case a single 0 byte is | * otherwise negative number follows, in which case a single 0 byte is | ||||
* necessary and even required). | * necessary and even required). | ||||
* | * | ||||
* See https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623 | * See https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623 | ||||
* | * | ||||
* This function is consensus-critical since BIP66. | * This function is consensus-critical since BIP66. | ||||
*/ | */ | ||||
static bool IsValidSignatureEncoding(const slicedvaltype &sig) { | static bool IsValidSignatureEncoding(const slicedvaltype &sig) { | ||||
// Format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] | // Format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] | ||||
▲ Show 20 Lines • Show All 230 Lines • Show Last 20 Lines |