Merge bitcoin-core/gui#188: Write PSBTs to file with binary mode

cc3971c9ff538a924c1a76ca1352bcaeb24f579f GUI: Write PSBTs to file with binary mode (Andrew Chow)

Pull request description:

  As noted in https://github.com/bitcoin/bitcoin/issues/20959, PSBT files should be opened in binary mode as on windows, all newlines are turned into CRLF which produces invalid PSBTs.

  Fixes https://github.com/bitcoin/bitcoin/issues/20959

ACKs for top commit:
  Talkless:
    utACK cc3971c9ff538a924c1a76ca1352bcaeb24f579f.

Tree-SHA512: fee62b66da844017a44d7d6da6d2d2794b097a7dec33fb07711615df1e94dccc76f987ffcbb325ad1f8db2a2dd6eaf514b6cbd2453e7658b9f6c9fb5c4c41dab
This commit is contained in:
MarcoFalke 2021-03-11 19:43:39 +01:00 committed by pasta
parent 9a02781412
commit 69431fd66a
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
2 changed files with 2 additions and 2 deletions

View File

@ -145,7 +145,7 @@ void PSBTOperationsDialog::saveTransaction() {
if (filename.isEmpty()) {
return;
}
std::ofstream out(filename.toLocal8Bit().data());
std::ofstream out(filename.toLocal8Bit().data(), std::ofstream::out | std::ofstream::binary);
out << ssTx.str();
out.close();
showStatus(tr("PSBT saved to disk."), StatusLevel::INFO);

View File

@ -518,7 +518,7 @@ void SendCoinsDialog::on_sendButton_clicked()
if (filename.isEmpty()) {
return;
}
std::ofstream out(filename.toLocal8Bit().data());
std::ofstream out(filename.toLocal8Bit().data(), std::ofstream::out | std::ofstream::binary);
out << ssTx.str();
out.close();
Q_EMIT message(tr("PSBT saved"), "PSBT saved to disk", CClientUIInterface::MSG_INFORMATION);