Changeset View
Changeset View
Standalone View
Standalone View
src/core_read.cpp
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <core_io.h> | #include <core_io.h> | ||||
#include <primitives/block.h> | #include <primitives/block.h> | ||||
#include <primitives/transaction.h> | #include <primitives/transaction.h> | ||||
#include <psbt.h> | #include <psbt.h> | ||||
#include <script/script.h> | #include <script/script.h> | ||||
#include <script/sign.h> | #include <script/sign.h> | ||||
#include <serialize.h> | #include <serialize.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <util/string.h> | |||||
#include <version.h> | #include <version.h> | ||||
#include <univalue.h> | #include <univalue.h> | ||||
#include <boost/algorithm/string/classification.hpp> | #include <boost/algorithm/string/classification.hpp> | ||||
#include <boost/algorithm/string/replace.hpp> | #include <boost/algorithm/string/replace.hpp> | ||||
#include <boost/algorithm/string/split.hpp> | #include <boost/algorithm/string/split.hpp> | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | CScript ParseScript(const std::string &s) { | ||||
next: | next: | ||||
size_t size_change = result.size() - script_size; | size_t size_change = result.size() - script_size; | ||||
// If push_size is set, ensure have added the right amount of stuff. | // If push_size is set, ensure have added the right amount of stuff. | ||||
if (push_size != 0 && size_change != push_size) { | if (push_size != 0 && size_change != push_size) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"Wrong number of bytes being pushed. Expected:" + | "Wrong number of bytes being pushed. Expected:" + | ||||
std::to_string(push_size) + | ToString(push_size) + " Pushed:" + ToString(size_change)); | ||||
" Pushed:" + std::to_string(size_change)); | |||||
} | } | ||||
// If push_size is set, and we have push_data_size set, then we have a | // If push_size is set, and we have push_data_size set, then we have a | ||||
// PUSHDATAX opcode. We need to read it's push size as a LE value for | // PUSHDATAX opcode. We need to read it's push size as a LE value for | ||||
// the next iteration of this loop. | // the next iteration of this loop. | ||||
if (push_size != 0 && push_data_size != 0) { | if (push_size != 0 && push_data_size != 0) { | ||||
auto offset = &result[script_size]; | auto offset = &result[script_size]; | ||||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |