2023-04-25 13:51:26 +02:00
|
|
|
// Copyright (c) 2018-2020 The Bitcoin Core developers
|
2021-08-05 16:41:46 +02:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#include <logging.h>
|
|
|
|
#include <util/system.h>
|
|
|
|
#include <walletinitinterface.h>
|
|
|
|
|
2021-08-10 07:48:49 +02:00
|
|
|
class CWallet;
|
|
|
|
|
2019-02-12 19:19:05 +01:00
|
|
|
namespace interfaces {
|
|
|
|
class Chain;
|
2019-09-27 13:31:44 +02:00
|
|
|
class Handler;
|
|
|
|
class Wallet;
|
2019-02-12 19:19:05 +01:00
|
|
|
}
|
|
|
|
|
2021-08-05 16:41:46 +02:00
|
|
|
class DummyWalletInit : public WalletInitInterface {
|
|
|
|
public:
|
|
|
|
|
|
|
|
bool HasWalletSupport() const override {return false;}
|
2022-05-21 10:27:30 +02:00
|
|
|
void AddWalletOptions(ArgsManager& argsman) const override;
|
2021-08-05 16:41:46 +02:00
|
|
|
bool ParameterInteraction() const override {return true;}
|
2022-04-05 11:09:41 +02:00
|
|
|
void Construct(NodeContext& node) const override {LogPrintf("No wallet support compiled in!\n");}
|
2021-08-05 16:41:46 +02:00
|
|
|
|
|
|
|
// Dash Specific WalletInitInterface InitCoinJoinSettings
|
|
|
|
void AutoLockMasternodeCollaterals() const override {}
|
2023-12-31 12:30:53 +01:00
|
|
|
void InitCoinJoinSettings(const CoinJoinWalletManager& cjwalletman) const override {}
|
2021-08-05 16:41:46 +02:00
|
|
|
bool InitAutoBackup() const override {return true;}
|
|
|
|
};
|
|
|
|
|
2022-05-21 10:27:30 +02:00
|
|
|
void DummyWalletInit::AddWalletOptions(ArgsManager& argsman) const
|
2021-08-05 16:41:46 +02:00
|
|
|
{
|
2022-05-21 10:27:30 +02:00
|
|
|
argsman.AddHiddenArgs({
|
2019-04-29 14:45:44 +02:00
|
|
|
"-avoidpartialspends",
|
|
|
|
"-createwalletbackups=<n>",
|
|
|
|
"-disablewallet",
|
|
|
|
"-instantsendnotify=<cmd>",
|
|
|
|
"-keypool=<n>",
|
Merge #14582: wallet: always do avoid partial spends if fees are within a specified range
7f13dfb587dd6a7a5b7dfbfe689ae0ce818fe5c9 test: test the implicit avoid partial spends functionality (Karl-Johan Alm)
b82067bf696c53f22536f9ca2e51949c164f6b06 wallet: try -avoidpartialspends mode and use its result if fees are below threshold (Karl-Johan Alm)
Pull request description:
The `-avoidpartialspends` feature is normally disabled, as it may affect the optimal fee for payments. This PR introduces a new parameter `-maxapsfee` (max avoid partial spends fee) which acts on the following values:
* -1: disable partial spend avoidance completely (do not even try it)
* 0: only do partial spend avoidance if fees are the same or better as the regular coin selection
* 1..∞: use APS variant if the absolute fee difference is less than or equal to the max APS fee
For values other than -1, the code will now try partial spend avoidance once, and if that gives a value within the accepted range, it will use that.
Example: -maxapsfee=0.00001000 means the wallet will do regular coin select, APS coin select, and then pick AKS iff the absolute fee difference is <= 1000 satoshi.
Edit: updated this to reflect the fact we are now using a max fee.
ACKs for top commit:
fjahr:
tested ACK 7f13dfb587dd6a7a5b7dfbfe689ae0ce818fe5c9
achow101:
ACK 7f13dfb587dd6a7a5b7dfbfe689ae0ce818fe5c9
jonatack:
ACK 7f13dfb58, code review, debug build, verified the test fails with `AssertionError: not(2 == 1)` for the number of vouts when `-maxapsfee=0.0001` is changed to 0, and verified the new logging with an added assertion.
meshcollider:
Code review ACK 7f13dfb587dd6a7a5b7dfbfe689ae0ce818fe5c9
Tree-SHA512: 475929df57f6191bb4e36bfbcad5a280a64bb0ecd8767b76cb2e44e2301235d0eb294a3f2fac5bbf15d35d7ecfba47acb2285feadb883c9ce31c08377e3afb3c
2020-08-17 05:56:49 +02:00
|
|
|
"-maxapsfee=<n>",
|
2021-12-12 14:38:12 +01:00
|
|
|
"-maxtxfee=<amt>",
|
2019-04-29 14:45:44 +02:00
|
|
|
"-rescan=<mode>",
|
|
|
|
"-salvagewallet",
|
|
|
|
"-spendzeroconfchange",
|
|
|
|
"-wallet=<path>",
|
|
|
|
"-walletbackupsdir=<dir>",
|
|
|
|
"-walletbroadcast",
|
|
|
|
"-walletdir=<dir>",
|
|
|
|
"-walletnotify=<cmd>",
|
|
|
|
"-discardfee=<amt>",
|
|
|
|
"-fallbackfee=<amt>",
|
|
|
|
"-mintxfee=<amt>",
|
|
|
|
"-paytxfee=<amt>",
|
|
|
|
"-txconfirmtarget=<n>",
|
|
|
|
"-hdseed=<hex>",
|
|
|
|
"-mnemonic=<text>",
|
|
|
|
"-mnemonicpassphrase=<text>",
|
|
|
|
"-usehd",
|
|
|
|
"-enablecoinjoin",
|
|
|
|
"-coinjoinamount=<n>",
|
|
|
|
"-coinjoinautostart",
|
|
|
|
"-coinjoindenomsgoal=<n>",
|
|
|
|
"-coinjoindenomshardcap=<n>",
|
|
|
|
"-coinjoinmultisession",
|
|
|
|
"-coinjoinrounds=<n>",
|
|
|
|
"-coinjoinsessions=<n>",
|
|
|
|
"-dblogsize=<n>",
|
|
|
|
"-flushwallet",
|
|
|
|
"-privdb",
|
2021-04-08 02:55:09 +02:00
|
|
|
"-walletrejectlongchains",
|
|
|
|
"-unsafesqlitesync"
|
2019-04-29 14:45:44 +02:00
|
|
|
});
|
2021-08-05 16:41:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const WalletInitInterface& g_wallet_init_interface = DummyWalletInit();
|
2021-08-10 07:48:49 +02:00
|
|
|
|
2019-09-27 13:31:44 +02:00
|
|
|
namespace interfaces {
|
2021-08-10 07:48:49 +02:00
|
|
|
|
2023-12-31 12:30:53 +01:00
|
|
|
std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet, const CoinJoinWalletManager& cjwalletman)
|
2021-08-10 07:48:49 +02:00
|
|
|
{
|
|
|
|
throw std::logic_error("Wallet function called in non-wallet build.");
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace interfaces
|