Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8378322
[Refactor] Replace optional reserveKey in PBF with unique pointer
random-zebra Apr 25, 2021
75c8c6d
Disallow copy of CReserveKeys
instagibbs Mar 3, 2017
0201065
Add COutput::fSafe member for safe handling of unconfirmed outputs
random-zebra Apr 25, 2021
f219be9
Add safe flag to listunspent result
NicolasDorier Feb 23, 2017
3a599d0
[Refactor] Return safeTx boolean in CheckTXAvailability
random-zebra May 28, 2021
3633d75
Initialize nRelockTime
pstratem Mar 14, 2017
60bb4da
ApproximateBestSubset should take inputs by reference, not value
RHavar Mar 28, 2017
7d977ac
Remove unused C++ code not covered by unit tests
random-zebra Apr 25, 2021
2394083
[Wallet] unset change position when there is no change on exact match
instagibbs Apr 28, 2017
494ba64
[test] Add test for getmemoryinfo
random-zebra Apr 25, 2021
54fa122
[qt] Move some WalletModel functions into CWallet
random-zebra Apr 28, 2021
e7cafab
[Refactoring] Mimic ListCoins for sapling notes
random-zebra Apr 28, 2021
5c3d73f
Avoid CWalletTx copies in GetAddressBalances and GetAddressGroupings
ryanofsky Jun 1, 2017
41a7335
Remove unused variables
practicalswift Jun 3, 2017
5bd1bd7
Properly forbid -salvagewallet and -zapwallettxes for multi wallet.
morcos Jul 13, 2017
7dd3916
Register wallet endpoint
jonasschnelli Jul 17, 2017
6cb2b92
Add wallet endpoint support to bitcoin-cli (-usewallet)
jonasschnelli Jul 13, 2017
b0fe92f
Fix test_pivx circular dependency issue
random-zebra Apr 28, 2021
5683a9c
Complete previous commit by moving mn stuff out of libbitcoin_wallet
random-zebra Apr 28, 2021
a64440b
Select wallet based on the given endpoint
jonasschnelli Jul 17, 2017
2e02006
Rename -usewallet to -rpcwallet
morcos Jul 19, 2017
f9141f8
[QA] Add wallet_multiwallet.py functional test
jnewbery Apr 28, 2021
808fbc3
[Bugfix] consider boolean value of -zapwallettxes ParameterInteraction
random-zebra Apr 28, 2021
379255e
[Tests][Trivial] Add wallet_multiwallet.py to test_runner
random-zebra Apr 28, 2021
9fb29cc
[Doc] Update multiwallet release notes
random-zebra Apr 28, 2021
a1c56fd
[Policy] Introduce -dustrelayfee
random-zebra Apr 28, 2021
cf4a90b
Remove factor of 3 from definition of dust.
random-zebra Apr 28, 2021
fdf5da0
[wallet] fix comment for CWallet::Verify()
jnewbery Jun 15, 2017
1525281
[wallet] [rpc] print wallet name in getwalletinfo
jnewbery Jun 15, 2017
4fd5913
[wallet] [rpc] Add listwallets RPC
jnewbery Jun 27, 2017
3955ee9
[Doc] Update release notes
random-zebra Apr 28, 2021
37089d1
[tests] Update wallet_multiwallet.py functional test
random-zebra Apr 28, 2021
ce35e1e
[Qt] Use wallet 0 in rpc console if running with multiple wallets
random-zebra Apr 28, 2021
ee52c2e
Fix misleading "Method not found" multiwallet errors
ryanofsky Jul 17, 2017
a1f4e2a
Reject duplicate wallet filenames
random-zebra Apr 28, 2021
900bbfa
Reject invalid wallet files
promag Jul 26, 2017
8bd979f
[wallet] Specify wallet name in wallet loading errors
random-zebra Apr 28, 2021
f49acf7
[wallet] [moveonly] Move CAffectedKeysVisitor
random-zebra Apr 28, 2021
2188c3e
Move some static functions out of wallet.h/cpp
random-zebra Apr 28, 2021
e947eec
MOVEONLY: Fee functions wallet/wallet.cpp -> wallet/fees.cpp
random-zebra Apr 28, 2021
e067235
MOVEONLY: Init functions wallet/wallet.cpp -> wallet/init.cpp
random-zebra Apr 28, 2021
ffcd781
[Trivial] Cleanup after MOVE-ONLY commits
random-zebra Apr 28, 2021
1d966ce
Add warnings field to getblockchaininfo
achow101 Jul 17, 2017
c04390b
Unify help text for GetWarnings output in get*info RPCs
random-zebra Apr 28, 2021
f15aeea
Change getmininginfo errors field to warnings
achow101 Sep 26, 2017
e411b70
[wallet] Fix leak in CDB constructor
promag Oct 12, 2017
20c269b
Avoid opening copied wallet databases simultaneously
ryanofsky Oct 10, 2017
dbda874
[Wallet] always show help-line of wallet encryption calls
jonasschnelli Nov 1, 2017
3711c6a
Add wallet backup text to import*, add* and dumpwallet RPCs
meshcollider Sep 8, 2017
d5526bd
Wrap dumpwallet warning and note scripts aren't dumped
meshcollider Oct 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,28 +251,16 @@ if(ZMQ_FOUND)
endif()

set(WALLET_SOURCES
./src/activemasternode.cpp
./src/bip38.cpp
./src/wallet/db.cpp
./src/addressbook.cpp
./src/crypter.cpp
./src/budget/budgetdb.cpp
./src/budget/budgetmanager.cpp
./src/budget/budgetproposal.cpp
./src/budget/budgetvote.cpp
./src/budget/finalizedbudget.cpp
./src/budget/finalizedbudgetvote.cpp
./src/masternode.cpp
./src/masternode-payments.cpp
./src/masternode-sync.cpp
./src/tiertwo_networksync.cpp
./src/masternodeconfig.cpp
./src/masternodeman.cpp
./src/messagesigner.cpp
./src/zpiv/mintpool.cpp
./src/wallet/hdchain.cpp
./src/wallet/rpcdump.cpp
./src/zpiv/zerocoin.cpp
./src/wallet/fees.cpp
./src/wallet/init.cpp
./src/wallet/scriptpubkeyman.cpp
./src/wallet/rpcwallet.cpp
./src/kernel.cpp
Expand Down Expand Up @@ -353,8 +341,15 @@ add_library(ZEROCOIN_A STATIC ${ZEROCOIN_SOURCES})
target_include_directories(ZEROCOIN_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)

set(COMMON_SOURCES
./src/activemasternode.cpp
./src/base58.cpp
./src/bip38.cpp
./src/budget/budgetdb.cpp
./src/budget/budgetmanager.cpp
./src/budget/budgetproposal.cpp
./src/budget/budgetvote.cpp
./src/budget/finalizedbudget.cpp
./src/budget/finalizedbudgetvote.cpp
./src/consensus/params.cpp
./src/consensus/upgrades.cpp
./src/chainparams.cpp
Expand All @@ -377,6 +372,12 @@ set(COMMON_SOURCES
./src/invalid.cpp
./src/key.cpp
./src/keystore.cpp
./src/masternode.cpp
./src/masternode-payments.cpp
./src/masternode-sync.cpp
./src/masternodeconfig.cpp
./src/masternodeman.cpp
./src/messagesigner.cpp
./src/netaddress.cpp
./src/netbase.cpp
./src/policy/feerate.cpp
Expand All @@ -391,6 +392,7 @@ set(COMMON_SOURCES
./src/script/script_error.cpp
./src/spork.cpp
./src/sporkdb.cpp
./src/tiertwo_networksync.cpp
./src/warnings.cpp
)
add_library(COMMON_A STATIC ${BitcoinHeaders} ${COMMON_SOURCES})
Expand Down
23 changes: 20 additions & 3 deletions doc/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Notable Changes

(Developers: add your notes here as part of your pull requests whenever possible)


Cold-Staking Re-Activation
--------------------------
PIVX Core v6.0.0 includes a fix for the vulnerability identified within the cold-staking protocol (see PR [#2258](https://github.com/PIVX-Project/PIVX/pull/2258)).
Expand All @@ -60,13 +61,24 @@ Scripts with the old opcode are still accepted on the network (the restriction o
Multi-wallet support
--------------------

PIVX Core now supports loading multiple, separate wallets (See [PR 2337](https://github.com/PIVX-Project/PIVX/pull/2337)). The wallets are completely separated, with individual balances, keys and received transactions.
PIVX Core now supports loading multiple, separate wallets (See [PR #2337](https://github.com/PIVX-Project/PIVX/pull/2337)). The wallets are completely separated, with individual balances, keys and received transactions.

Multi-wallet is enabled by using more than one `-wallet` argument when starting PIVX client, either on the command line or in the pivx.conf config file.

**In pivx-qt, only the first wallet will be displayed and accessible for creating and signing transactions.** GUI selectable multiple wallets will be supported in a future version. However, even in 6.0 other loaded wallets will remain synchronized to the node's current tip in the background.

!TODO: update after endpoint support and multi-wallet RPC support
PIVX Core 6.0.0 contains the following changes to the RPC interface and pivx-cli for multi-wallet:

* When running PIVX Core with a single wallet, there are **no** changes to the RPC interface or `pivx-cli`. All RPC calls and `pivx-cli` commands continue to work as before.
* When running PIVX Core with multi-wallet, all *node-level* RPC methods continue to work as before. HTTP RPC requests should be send to the normal `<RPC IP address>:<RPC port>` endpoint, and `pivx-cli` commands should be run as before. A *node-level* RPC method is any method which does not require access to the wallet.
* When running PIVX Core with multi-wallet, *wallet-level* RPC methods must specify the wallet for which they're intended in every request. HTTP RPC requests should be send to the `<RPC IP address>:<RPC port>/wallet/<wallet name>` endpoint, for example `127.0.0.1:8332/wallet/wallet1.dat`. `pivx-cli` commands should be run with a `-rpcwallet` option, for example `pivx-cli -rpcwallet=wallet1.dat getbalance`.

* A new *node-level* `listwallets` RPC method is added to display which wallets are currently loaded. The names returned by this method are the same as those used in the HTTP endpoint and for the `rpcwallet` argument.

The `getwalletinfo` RPC method returns the name of the wallet used for the query.

Note that while multi-wallet is now fully supported, the RPC multi-wallet interface should be considered unstable for version 6.0.0, and there may backwards-incompatible changes in future versions.



GUI changes
Expand Down Expand Up @@ -125,13 +137,18 @@ A new init option flag '-blocksdir' will allow one to keep the blockfiles extern
Low-level RPC changes
---------------------

- The `listunspent` RPC now takes a `query_options` argument (see [PR 2317](https://github.com/PIVX-Project/PIVX/pull/2317)), which is a JSON object
- The `listunspent` RPC now takes a `query_options` argument (see [PR #2317](https://github.com/PIVX-Project/PIVX/pull/2317)), which is a JSON object
containing one or more of the following members:
- `minimumAmount` - a number specifying the minimum value of each UTXO
- `maximumAmount` - a number specifying the maximum value of each UTXO
- `maximumCount` - a number specifying the minimum number of UTXOs
- `minimumSumAmount` - a number specifying the minimum sum value of all UTXOs

- The `listunspent` RPC also takes an additional boolean argument `include_unsafe` (true by default) to optionally exclude "unsafe" utxos.
An unconfirmed output from outside keys is considered unsafe (see [PR #2351](https://github.com/PIVX-Project/PIVX/pull/2351)).

- The `listunspent` output also shows whether the utxo is considered safe to spend or not.

- the `stop` RPC no longer accepts the (already deprecated, ignored, and undocumented) optional boolean argument `detach`.


Expand Down
32 changes: 18 additions & 14 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ BITCOIN_CORE_H = \
wallet/rpcwallet.h \
wallet/scriptpubkeyman.h \
destination_io.h \
wallet/fees.h \
wallet/init.h \
wallet/wallet.h \
wallet/walletdb.h \
warnings.h \
Expand Down Expand Up @@ -387,28 +389,16 @@ endif
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_wallet_a_SOURCES = \
activemasternode.cpp \
bip38.cpp \
interfaces/wallet.cpp \
addressbook.cpp \
crypter.cpp \
key_io.cpp \
budget/budgetdb.cpp \
budget/budgetmanager.cpp \
budget/budgetproposal.cpp \
budget/budgetvote.cpp \
budget/finalizedbudget.cpp \
budget/finalizedbudgetvote.cpp \
masternode.cpp \
masternode-payments.cpp \
tiertwo_networksync.cpp \
masternode-sync.cpp \
masternodeconfig.cpp \
masternodeman.cpp \
messagesigner.cpp \
legacy/stakemodifier.cpp \
kernel.cpp \
wallet/db.cpp \
wallet/fees.cpp \
wallet/init.cpp \
wallet/rpcdump.cpp \
wallet/rpcwallet.cpp \
wallet/hdchain.cpp \
Expand Down Expand Up @@ -491,8 +481,15 @@ libzerocoin_libbitcoin_zerocoin_a_SOURCES = \
libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_common_a_SOURCES = \
activemasternode.cpp \
base58.cpp \
bip38.cpp \
budget/budgetdb.cpp \
budget/budgetmanager.cpp \
budget/budgetproposal.cpp \
budget/budgetvote.cpp \
budget/finalizedbudget.cpp \
budget/finalizedbudgetvote.cpp \
chainparams.cpp \
consensus/upgrades.cpp \
coins.cpp \
Expand All @@ -507,6 +504,12 @@ libbitcoin_common_a_SOURCES = \
invalid.cpp \
key.cpp \
keystore.cpp \
masternode.cpp \
masternode-payments.cpp \
masternode-sync.cpp \
masternodeconfig.cpp \
masternodeman.cpp \
messagesigner.cpp \
netaddress.cpp \
netbase.cpp \
policy/feerate.cpp \
Expand All @@ -518,6 +521,7 @@ libbitcoin_common_a_SOURCES = \
script/script.cpp \
script/sign.cpp \
script/standard.cpp \
tiertwo_networksync.cpp \
warnings.cpp \
script/script_error.cpp \
spork.cpp \
Expand Down
6 changes: 3 additions & 3 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ test_test_pivx_SOURCES = $(BITCOIN_TEST_SUITE) $(BITCOIN_TESTS) $(SAPLING_TESTS)
test_test_pivx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -I$(builddir)/test/ $(TESTDEFS) $(EVENT_FLAGS)
test_test_pivx_LDADD =

test_test_pivx_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBBITCOIN_ZEROCOIN) \
$(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(LIBSAPLING) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS)

if ENABLE_WALLET
test_test_pivx_LDADD += $(LIBBITCOIN_WALLET)
endif

test_test_pivx_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBBITCOIN_ZEROCOIN) \
$(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(LIBSAPLING) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS)

test_test_pivx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)

test_test_pivx_LDADD += $(LIBRUSTZCASH) $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(LIBZCASH_LIBS)
Expand Down
2 changes: 2 additions & 0 deletions src/guiinterfaceutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#define GUIINTERFACEUTIL_H

#include "guiinterface.h"
#include "tinyformat.h"
#include "util/system.h"

inline static bool UIError(const std::string &str)
{
Expand Down
5 changes: 4 additions & 1 deletion src/httprpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ bool StartHTTPRPC()
return false;

RegisterHTTPHandler("/", true, HTTPReq_JSONRPC);

#ifdef ENABLE_WALLET
// ifdef can be removed once we switch to better endpoint support and API versioning
RegisterHTTPHandler("/wallet/", false, HTTPReq_JSONRPC);
#endif
assert(EventBase());
httpRPCTimerInterface = new HTTPRPCTimerInterface(EventBase());
RPCSetTimerInterface(httpRPCTimerInterface);
Expand Down
16 changes: 14 additions & 2 deletions src/httpserver.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2015 The Bitcoin Core developers
// Copyright (c) 2018-2020 The PIVX developers
// Copyright (c) 2015-2021 The Bitcoin Core developers
// Copyright (c) 2018-2021 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down Expand Up @@ -679,3 +679,15 @@ void UnregisterHTTPHandler(const std::string &prefix, bool exactMatch)
pathHandlers.erase(i);
}
}

std::string urlDecode(const std::string &urlEncoded) {
std::string res;
if (!urlEncoded.empty()) {
char *decoded = evhttp_uridecode(urlEncoded.c_str(), false, NULL);
if (decoded) {
res = std::string(decoded);
free(decoded);
}
}
return res;
}
11 changes: 7 additions & 4 deletions src/httpserver.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright (c) 2015 The Bitcoin Core developers
// Copyright (c) 2015-2021 The Bitcoin Core developers
// Copyright (c) 2021 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_HTTPSERVER_H
#define BITCOIN_HTTPSERVER_H
#ifndef PIVX_HTTPSERVER_H
#define PIVX_HTTPSERVER_H

#include <string>
#include <stdint.h>
Expand Down Expand Up @@ -148,4 +149,6 @@ class HTTPEvent
struct event* ev;
};

#endif // BITCOIN_HTTPSERVER_H
std::string urlDecode(const std::string &urlEncoded);

#endif // PIVX_HTTPSERVER_H
22 changes: 16 additions & 6 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
#include "validation.h"
#include "validationinterface.h"
#include "zpivchain.h"
#include "warnings.h"

#ifdef ENABLE_WALLET
#include "wallet/init.h"
#include "wallet/wallet.h"
#include "wallet/rpcwallet.h"

#endif
#include "warnings.h"

#include <atomic>
#include <fstream>
Expand Down Expand Up @@ -507,7 +507,7 @@ std::string HelpMessage(HelpMessageMode mode)
" " + _("Whitelisted peers cannot be DoS banned and their transactions are always relayed, even if they are already in the mempool, useful e.g. for a gateway"));

#if ENABLE_WALLET
strUsage += CWallet::GetWalletHelpString(showDebug);
strUsage += GetWalletHelpString(showDebug);
#endif

if (mode == HMM_BITCOIN_QT) {
Expand Down Expand Up @@ -561,6 +561,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Fees (in %s/Kb) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)"), CURRENCY_UNIT, FormatMoney(::minRelayTxFee.GetFeePerK())));
strUsage += HelpMessageOpt("-printtoconsole", strprintf(_("Send trace/debug info to console instead of debug.log file (default: %u)"), 0));
if (showDebug) {
strUsage += HelpMessageOpt("-dustrelayfee=<amt>", strprintf("Fee rate (in %s/kB) used to define dust, the value of an output such that it will cost more than its value in fees at this fee rate to spend it. (default: %s)", CURRENCY_UNIT, FormatMoney(DUST_RELAY_TX_FEE)));
strUsage += HelpMessageOpt("-printpriority", strprintf(_("Log transaction priority and fee per kB when mining blocks (default: %u)"), DEFAULT_PRINTPRIORITY));
}
strUsage += HelpMessageOpt("-shrinkdebugfile", _("Shrink debug.log file on client startup (default: 1 when no -debug)"));
Expand Down Expand Up @@ -1146,9 +1147,18 @@ bool AppInitParameterInteraction()
if (!chainparams.IsTestChain() && !fRequireStandard)
return UIError(strprintf("%s is not currently supported for %s chain", "-acceptnonstdtxn", chainparams.NetworkIDString()));

// Feerate used to define dust. Shouldn't be changed lightly as old
// implementations may inadvertently create non-standard transactions
if (gArgs.IsArgSet("-dustrelayfee")) {
CAmount n = 0;
if (!ParseMoney(gArgs.GetArg("-dustrelayfee", ""), n) || 0 == n)
return UIError(AmountErrMsg("dustrelayfee", gArgs.GetArg("-dustrelayfee", "")));
dustRelayFee = CFeeRate(n);
}

#ifdef ENABLE_WALLET
strWalletFile = gArgs.GetArg("-wallet", DEFAULT_WALLET_DAT);
if (!CWallet::ParameterInteraction())
if (!WalletParameterInteraction())
return false;
#endif // ENABLE_WALLET

Expand Down Expand Up @@ -1322,7 +1332,7 @@ bool AppInitMain()

// ********************************************************* Step 5: Verify wallet database integrity
#ifdef ENABLE_WALLET
if (!CWallet::Verify()) {
if (!WalletVerify()) {
return false;
}
#endif
Expand Down Expand Up @@ -1711,7 +1721,7 @@ bool AppInitMain()

// ********************************************************* Step 8: Backup and Load wallet
#ifdef ENABLE_WALLET
if (!CWallet::InitLoadWallet())
if (!InitLoadWallet())
return false;
#else
LogPrintf("No wallet compiled in!\n");
Expand Down
Loading