mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-06 13:10:09 +02:00
refactor: Change createWallet, fillPSBT argument order
Move output arguments after input arguments for consistency with other methods, and to work more easily with IPC framework in #10102
This commit is contained in:
parent
96dfe5ced6
commit
1dca9dc4c7
@ -262,12 +262,11 @@ public:
|
|||||||
{
|
{
|
||||||
return MakeWallet(LoadWallet(*m_context.chain, name, error, warnings));
|
return MakeWallet(LoadWallet(*m_context.chain, name, error, warnings));
|
||||||
}
|
}
|
||||||
WalletCreationStatus createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::vector<std::string>& warnings, std::unique_ptr<Wallet>& result) override
|
std::unique_ptr<Wallet> createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::vector<std::string>& warnings, WalletCreationStatus& status) override
|
||||||
{
|
{
|
||||||
std::shared_ptr<CWallet> wallet;
|
std::shared_ptr<CWallet> wallet;
|
||||||
WalletCreationStatus status = CreateWallet(*m_context.chain, passphrase, wallet_creation_flags, name, error, warnings, wallet);
|
status = CreateWallet(*m_context.chain, passphrase, wallet_creation_flags, name, error, warnings, wallet);
|
||||||
result = MakeWallet(wallet);
|
return MakeWallet(wallet);
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
|
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
|
||||||
{
|
{
|
||||||
|
@ -204,7 +204,7 @@ public:
|
|||||||
virtual std::unique_ptr<Wallet> loadWallet(const std::string& name, std::string& error, std::vector<std::string>& warnings) = 0;
|
virtual std::unique_ptr<Wallet> loadWallet(const std::string& name, std::string& error, std::vector<std::string>& warnings) = 0;
|
||||||
|
|
||||||
//! Create a wallet from file
|
//! Create a wallet from file
|
||||||
virtual WalletCreationStatus createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::vector<std::string>& warnings, std::unique_ptr<Wallet>& result) = 0;
|
virtual std::unique_ptr<Wallet> createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::vector<std::string>& warnings, WalletCreationStatus& status) = 0;
|
||||||
|
|
||||||
//! Register handler for init messages.
|
//! Register handler for init messages.
|
||||||
using InitMessageFn = std::function<void(const std::string& message)>;
|
using InitMessageFn = std::function<void(const std::string& message)>;
|
||||||
|
@ -352,11 +352,11 @@ public:
|
|||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
TransactionError fillPSBT(PartiallySignedTransaction& psbtx,
|
TransactionError fillPSBT(int sighash_type,
|
||||||
bool& complete,
|
bool sign,
|
||||||
int sighash_type = 1 /* SIGHASH_ALL */,
|
bool bip32derivs,
|
||||||
bool sign = true,
|
PartiallySignedTransaction& psbtx,
|
||||||
bool bip32derivs = false) const override
|
bool& complete) override
|
||||||
{
|
{
|
||||||
return m_wallet->FillPSBT(psbtx, complete, sighash_type, sign, bip32derivs);
|
return m_wallet->FillPSBT(psbtx, complete, sighash_type, sign, bip32derivs);
|
||||||
}
|
}
|
||||||
|
@ -193,11 +193,11 @@ public:
|
|||||||
int& num_blocks) = 0;
|
int& num_blocks) = 0;
|
||||||
|
|
||||||
//! Fill PSBT.
|
//! Fill PSBT.
|
||||||
virtual TransactionError fillPSBT(PartiallySignedTransaction& psbtx,
|
virtual TransactionError fillPSBT(int sighash_type,
|
||||||
bool& complete,
|
bool sign,
|
||||||
int sighash_type = 1 /* SIGHASH_ALL */,
|
bool bip32derivs,
|
||||||
bool sign = true,
|
PartiallySignedTransaction& psbtx,
|
||||||
bool bip32derivs = false) const = 0;
|
bool& complete) = 0;
|
||||||
|
|
||||||
//! Get balances.
|
//! Get balances.
|
||||||
virtual WalletBalances getBalances() = 0;
|
virtual WalletBalances getBalances() = 0;
|
||||||
|
@ -391,7 +391,7 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|||||||
CMutableTransaction mtx = CMutableTransaction{*(currentTransaction.getWtx())};
|
CMutableTransaction mtx = CMutableTransaction{*(currentTransaction.getWtx())};
|
||||||
PartiallySignedTransaction psbtx(mtx);
|
PartiallySignedTransaction psbtx(mtx);
|
||||||
bool complete = false;
|
bool complete = false;
|
||||||
const TransactionError err = model->wallet().fillPSBT(psbtx, complete, SIGHASH_ALL, false /* sign */, true /* bip32derivs */);
|
const TransactionError err = model->wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, psbtx, complete);
|
||||||
assert(!complete);
|
assert(!complete);
|
||||||
assert(err == TransactionError::OK);
|
assert(err == TransactionError::OK);
|
||||||
// Serialize the PSBT
|
// Serialize the PSBT
|
||||||
|
@ -218,8 +218,8 @@ void CreateWalletActivity::createWallet()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QTimer::singleShot(500, worker(), [this, name, flags] {
|
QTimer::singleShot(500, worker(), [this, name, flags] {
|
||||||
std::unique_ptr<interfaces::Wallet> wallet;
|
WalletCreationStatus status;
|
||||||
WalletCreationStatus status = node().createWallet(m_passphrase, flags, name, m_error_message, m_warning_message, wallet);
|
std::unique_ptr<interfaces::Wallet> wallet = node().createWallet(m_passphrase, flags, name, m_error_message, m_warning_message, status);
|
||||||
|
|
||||||
if (status == WalletCreationStatus::SUCCESS) m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(wallet));
|
if (status == WalletCreationStatus::SUCCESS) m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(wallet));
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
|
|||||||
if (create_psbt) {
|
if (create_psbt) {
|
||||||
PartiallySignedTransaction psbtx(mtx);
|
PartiallySignedTransaction psbtx(mtx);
|
||||||
bool complete = false;
|
bool complete = false;
|
||||||
const TransactionError err = wallet().fillPSBT(psbtx, complete, SIGHASH_ALL, false /* sign */, true /* bip32derivs */);
|
const TransactionError err = wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, psbtx, complete);
|
||||||
if (err != TransactionError::OK || complete) {
|
if (err != TransactionError::OK || complete) {
|
||||||
QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Can't draft transaction."));
|
QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Can't draft transaction."));
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user