diff options
Diffstat (limited to 'src/core_read.cpp')
-rw-r--r-- | src/core_read.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core_read.cpp b/src/core_read.cpp index 4d851610ef..7ee3edc1f3 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -7,6 +7,7 @@ #include <primitives/block.h> #include <primitives/transaction.h> #include <script/script.h> +#include <script/sign.h> #include <serialize.h> #include <streams.h> #include <univalue.h> @@ -160,6 +161,23 @@ bool DecodeHexBlk(CBlock& block, const std::string& strHexBlk) return true; } +bool DecodePSBT(PartiallySignedTransaction& psbt, const std::string& base64_tx, std::string& error) +{ + std::vector<unsigned char> tx_data = DecodeBase64(base64_tx.c_str()); + CDataStream ss_data(tx_data, SER_NETWORK, PROTOCOL_VERSION); + try { + ss_data >> psbt; + if (!ss_data.empty()) { + error = "extra data after PSBT"; + return false; + } + } catch (const std::exception& e) { + error = e.what(); + return false; + } + return true; +} + uint256 ParseHashStr(const std::string& strHex, const std::string& strName) { if (!IsHex(strHex)) // Note: IsHex("") is false |