mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-18 22:20:44 +02:00
Merge bitcoin-core/gui#469: Load Base64 PSBT string from file
2c3ee4c347
gui: Load Base64 PSBT string from file (Andrew Chow) Pull request description: Some .psbt files may have the PSBT as a base64 string instead of in binary. We should be able to load those files. ACKs for top commit: jarolrod: tACK2c3ee4c347
shaavan: ACK2c3ee4c347
Tree-SHA512: 352b0611693c8989ea7d1b8d494ea58c69dc15cf81b8d62271541832e74b0a0399cb6ed4e686ab7c741cb4e5374527e054a9ecfe7355bc6f77d8fdd13569ab76
This commit is contained in:
commit
6decdedaf9
@ -213,6 +213,14 @@ void WalletFrame::gotoLoadPSBT(bool from_clipboard)
|
||||
}
|
||||
std::ifstream in{filename.toLocal8Bit().data(), std::ios::binary};
|
||||
data.assign(std::istream_iterator<unsigned char>{in}, {});
|
||||
|
||||
// Some psbt files may be base64 strings in the file rather than binary data
|
||||
std::string b64_str{data.begin(), data.end()};
|
||||
b64_str.erase(b64_str.find_last_not_of(" \t\n\r\f\v") + 1); // Trim trailing whitespace
|
||||
auto b64_dec = DecodeBase64(b64_str);
|
||||
if (b64_dec.has_value()) {
|
||||
data = b64_dec.value();
|
||||
}
|
||||
}
|
||||
|
||||
std::string error;
|
||||
|
Loading…
Reference in New Issue
Block a user