From 1dca9dc4c772fa0a4ec52c4d88b7cd3d243aea7b Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 5 Dec 2017 15:57:12 -0500 Subject: 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 --- src/interfaces/node.cpp | 7 +++---- src/interfaces/node.h | 2 +- src/interfaces/wallet.cpp | 10 +++++----- src/interfaces/wallet.h | 10 +++++----- 4 files changed, 14 insertions(+), 15 deletions(-) (limited to 'src/interfaces') diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp index 25e5b0f7e4..905173d20b 100644 --- a/src/interfaces/node.cpp +++ b/src/interfaces/node.cpp @@ -262,12 +262,11 @@ public: { 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& warnings, std::unique_ptr& result) override + std::unique_ptr createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::vector& warnings, WalletCreationStatus& status) override { std::shared_ptr wallet; - WalletCreationStatus status = CreateWallet(*m_context.chain, passphrase, wallet_creation_flags, name, error, warnings, wallet); - result = MakeWallet(wallet); - return status; + status = CreateWallet(*m_context.chain, passphrase, wallet_creation_flags, name, error, warnings, wallet); + return MakeWallet(wallet); } std::unique_ptr handleInitMessage(InitMessageFn fn) override { diff --git a/src/interfaces/node.h b/src/interfaces/node.h index a0466bd297..53a20886cd 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -204,7 +204,7 @@ public: virtual std::unique_ptr loadWallet(const std::string& name, std::string& error, std::vector& warnings) = 0; //! 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& warnings, std::unique_ptr& result) = 0; + virtual std::unique_ptr createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::vector& warnings, WalletCreationStatus& status) = 0; //! Register handler for init messages. using InitMessageFn = std::function; diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index c2d42d78d3..c3a62cf73d 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -352,11 +352,11 @@ public: } return {}; } - TransactionError fillPSBT(PartiallySignedTransaction& psbtx, - bool& complete, - int sighash_type = 1 /* SIGHASH_ALL */, - bool sign = true, - bool bip32derivs = false) const override + TransactionError fillPSBT(int sighash_type, + bool sign, + bool bip32derivs, + PartiallySignedTransaction& psbtx, + bool& complete) override { return m_wallet->FillPSBT(psbtx, complete, sighash_type, sign, bip32derivs); } diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 56829289b2..487a7c3a5a 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -193,11 +193,11 @@ public: int& num_blocks) = 0; //! Fill PSBT. - virtual TransactionError fillPSBT(PartiallySignedTransaction& psbtx, - bool& complete, - int sighash_type = 1 /* SIGHASH_ALL */, - bool sign = true, - bool bip32derivs = false) const = 0; + virtual TransactionError fillPSBT(int sighash_type, + bool sign, + bool bip32derivs, + PartiallySignedTransaction& psbtx, + bool& complete) = 0; //! Get balances. virtual WalletBalances getBalances() = 0; -- cgit v1.2.3