Commit graph

194 commits

Author SHA1 Message Date
Cozz Lovan
0ed9675be4 [Wallet] Add global boolean whether to send free transactions (default=true) 2014-11-19 16:04:53 +01:00
Wladimir J. van der Laan
c4761ffb70
Merge pull request #5146
5b40d88 Update comments in wallet to be doxygen compatible (Michael Ford)
2014-10-30 17:15:09 +01:00
Pieter Wuille
723c752636
Merge pull request #5100
99f41b9 MOVEONLY: core.o -> core/block.o (jtimon)
561e9e9 MOVEONLY: Move script/compressor out of script and put CTxOutCompressor (from core) with it (jtimon)
999a2ab MOVEONLY: separate CTxUndo out of core (jtimon)
4a3587d MOVEONLY: Separate CTransaction and dependencies from core (jtimon)
eda3733 MOVEONLY: Move CFeeRate and Amount constants to amount.o (jtimon)
2014-10-28 05:27:41 -07:00
Michael Ford
5b40d88688 Update comments in wallet to be doxygen compatible 2014-10-28 11:47:49 +08:00
jtimon
99f41b9cf7 MOVEONLY: core.o -> core/block.o 2014-10-27 13:54:37 +01:00
jtimon
4a3587d8db MOVEONLY: Separate CTransaction and dependencies from core 2014-10-27 13:54:37 +01:00
jtimon
eda3733091 MOVEONLY: Move CFeeRate and Amount constants to amount.o 2014-10-27 13:54:37 +01:00
Daniel Kraft
a31e8bad53 Make CBlockIndex* returned by GetDepthInMainChain const.
Make the CBlockIndex* (optionally) returned by GetDepthInMainChain
const.  This prevents accidental modification.  The result is for
reading its properties rather than modifying it.
2014-10-24 16:13:41 +02:00
Pieter Wuille
a96d113962 Rename CWalletInterface to CValidationInterface
It's useful for much more than wallets.
2014-10-20 10:59:12 -07:00
Wladimir J. van der Laan
d7e1950483
Merge pull request #4937
ccca27a [Wallet] Watch-only fixes (Cozz Lovan)
2014-10-13 13:57:07 +02:00
Pieter Wuille
dec58922d0
Merge pull request #4996
d0c4197 change exit(1) to an assert in CWallet::EncryptWallet (Philip Kaufmann)
870da77 fix possible memory leaks in CWallet::EncryptWallet (Philip Kaufmann)
f606bb9 fix a possible memory leak in CWalletDB::Recover (Philip Kaufmann)
2014-10-08 15:51:32 -07:00
Cozz Lovan
ccca27a788 [Wallet] Watch-only fixes 2014-10-03 04:29:51 +02:00
Philip Kaufmann
870da77da6 fix possible memory leaks in CWallet::EncryptWallet
- add missing deletes for pwalletdbEncryption
- add an assert before trying to reserve memory for pwalletdbEncryption
- add a destructor to CWallet, which ensures deletion of
  pwalletdbEncryption on object destruction
2014-10-01 08:48:23 +02:00
Mark Friedenbach
a372168e77 Use a typedef for monetary values 2014-09-26 15:42:04 -07:00
Wladimir J. van der Laan
3cdae61aa2
Merge pull request #4787
4b0deb3 Clean up CMerkleTx::SetMerkleBranch. (Daniel Kraft)
2014-09-22 14:18:54 +02:00
Philip Kaufmann
611116d4e3 header include cleanup
- ensures alphabetical ordering for includes etc. in source file headers
2014-09-14 12:43:56 +02:00
jtimon
c1e433b717 Rename scriptutils.o to wallet_ismine.o 2014-09-10 12:48:35 +02:00
jtimon
c4408a6c85 Separate script/standard 2014-09-08 20:21:35 +02:00
Pieter Wuille
3f6540ad8f Rename IMPLEMENT_SERIALIZE to ADD_SERIALIZE_METHODS 2014-09-02 09:58:09 +02:00
Pieter Wuille
47eb76597e Serializer simplifications after IMPLEMENT_SERIALIZE overhaul 2014-09-01 22:00:19 +02:00
Pieter Wuille
2e731f24b5
Merge pull request #4737
31e9a83 Use CSizeComputer to avoid counting sizes in SerializationOp (Pieter Wuille)
84881f8 rework overhauled serialization methods to non-static (Kamil Domanski)
5d96b4a remove fields of ser_streamplaceholder (Kamil Domanski)
3d796f8 overhaul serialization code (Kamil Domanski)
2014-09-01 21:23:01 +02:00
Wladimir J. van der Laan
f6a8105037
Merge pull request #4779
093303a add missing header end comments (Philip Kaufmann)
2014-09-01 15:35:09 +02:00
Pieter Wuille
31e9a8384a Use CSizeComputer to avoid counting sizes in SerializationOp 2014-08-31 02:18:42 +02:00
Kamil Domanski
84881f8c47 rework overhauled serialization methods to non-static
Thanks to Pieter Wuille for most of the work on this commit.
I did not fixup the overhaul commit, because a rebase conflicted
with "remove fields of ser_streamplaceholder".
I prefer not to risk making a mistake while resolving it.
2014-08-31 02:16:17 +02:00
Kamil Domanski
3d796f8996 overhaul serialization code
The implementation of each class' serialization/deserialization is no longer
passed within a macro. The implementation now lies within a template of form:

template <typename T, typename Stream, typename Operation>
inline static size_t SerializationOp(T thisPtr, Stream& s, Operation ser_action, int nType, int nVersion) {
    size_t nSerSize = 0;
    /* CODE */
    return nSerSize;
}

In cases when codepath should depend on whether or not we are just deserializing
(old fGetSize, fWrite, fRead flags) an additional clause can be used:
bool fRead = boost::is_same<Operation, CSerActionUnserialize>();

The IMPLEMENT_SERIALIZE macro will now be a freestanding clause added within
class' body (similiar to Qt's Q_OBJECT) to implement GetSerializeSize,
Serialize and Unserialize. These are now wrappers around
the "SerializationOp" template.
2014-08-31 02:14:20 +02:00
Daniel Kraft
4b0deb3b2d Clean up CMerkleTx::SetMerkleBranch.
The case SetMerkleBranch(NULL) was never actually used, and thus the
involved code (loading the block from disk) can be removed and the
implementation simplified.
2014-08-30 18:00:55 +02:00
Wladimir J. van der Laan
0101483f46
Move CMerkleTx to wallet.cpp/h
It is only used by the wallet so it has no place in main.
2014-08-29 17:26:01 +02:00
Philip Kaufmann
093303a887 add missing header end comments
- ensures a consistent usage in header files
- also add a blank line after the copyright header where missing
- also remove orphan new-lines at the end of some files
2014-08-28 22:25:21 +02:00
Wladimir J. van der Laan
8bdd2877c4
Fix a few "Uninitialized scalar field" warnings
Fix a few warnings reported by Coverity.
None of these is critical, but making sure that class fields are
initialized can avoid heisenbugs.
2014-08-28 15:30:50 +02:00
Wladimir J. van der Laan
d49b0876a4
Merge pull request #4673
1c5f0af [Qt] Add column Watch-only to transactions list (Cozz Lovan)
939ed97 Add boolean HaveWatchonly and signal NotifyWatchonlyChanged (Cozz Lovan)
2014-08-26 17:41:33 +02:00
Wladimir J. van der Laan
ad49c256c3 Split up util.cpp/h
Split up util.cpp/h into:

- string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach)
- money utilities (parsesmoney, formatmoney)
- time utilities (gettime*, sleep, format date):
- and the rest (logging, argument parsing, config file parsing)

The latter is basically the environment and OS handling,
and is stripped of all utility functions, so we may want to
rename it to something else than util.cpp/h for clarity (Matt suggested
osinterface).

Breaks dependency of sha256.cpp on all the things pulled in by util.
2014-08-26 13:25:22 +02:00
Wladimir J. van der Laan
af8297c010 Move functions in wallet.h to implementation file
Breaks compile-time dependency of wallet.h on util.
2014-08-26 13:25:21 +02:00
Wladimir J. van der Laan
3802224110 Remove all other print() methods
All unused.
2014-08-20 20:54:27 +02:00
Cozz Lovan
939ed97373 Add boolean HaveWatchonly and signal NotifyWatchonlyChanged 2014-08-11 18:47:02 +02:00
Pieter Wuille
216e9a4456 Add a way to limit deserialized string lengths
and use it for most strings being serialized.
2014-08-09 01:37:16 +02:00
Wladimir J. van der Laan
3015e0bca6 Revert "UI to alert of respend attempt affecting wallet."
This reverts commit ada5a067c7.

Conflicts:
	src/qt/guiconstants.h
	src/wallet.h
2014-07-21 07:46:33 +02:00
Cozz Lovan
1b4568cb0f Add vout to ListTransactions output 2014-07-15 15:50:33 +02:00
Wladimir J. van der Laan
f748ff730b
Merge pull request #4045
a3e192a replaced MINE_ with ISMINE_ (JaSK)
53a2148 fixed bug where validateaddress doesn't display information (JaSK)
f28707a fixed bug in ListReceived() (JaSK)
519dd1c Added MINE_ALL = (spendable|watchonly) (JaSK)
23b0506 Fixed some stuff in TransactionDesc (JaSK)
80dda36 removed default argument values for ismine filter (JaSK)
d5087d1 Use script matching rather than destination matching for watch-only. (Pieter Wuille)
0fa2f88 added includedWatchonly argument to listreceivedbyaddress/...account (JaSK)
f87ba3d added includeWatchonly argument to 'gettransaction' because it affects balance calculation (JaSK)
a5c6c5d fixed tiny glitch and improved readability like laanwj suggested (JaSK)
d7d5d23 Added argument to listtransactions and listsinceblock to include watchonly addresses (JaSK)
952877e Showing 'involvesWatchonly' property for transactions returned by 'listtransactions' and 'listsinceblock'. It is only appended when the transaction involves a watchonly address. (JaSK)
83f3543 Added argument to listaccounts to include watchonly addresses (JaSK)
d4640d7 Added argument to getbalance to include watchonly addresses and fixed errors in balance calculation. (JaSK)
d2692f6 Watchonly transactions are marked in transaction history (JaSK)
ffd40da Watchonly balances are shown separately in gui. (JaSK)
2935b21 qt: Hide unspendable outputs in coin control (Wladimir J. van der Laan)
c898846 Add support for watch-only addresses (Pieter Wuille)
2014-07-07 16:06:28 +02:00
Daniel Kraft
e832ab7754 Rename SendMoneyToDestination to SendMoney.
Get rid of SendMoney and replace it by the functionality of
SendMoneyToDestination.  This cleans up the code, since only
SendMoneyToDestination was actually used (SendMoney internally from this
routine).
2014-07-07 09:41:33 +02:00
Gavin Andresen
13fc83c77b
Move fee policy out of core 2014-07-03 14:42:16 -04:00
Gavin Andresen
b33d1f5ee5
Use fee/priority estimates in wallet CreateTransaction
The wallet now uses the mempool fee estimator with a new
command-line option: -txconfirmtarget (default: 1) instead
of using hard-coded fees or priorities.

A new bitcoind that hasn't seen enough transactions to estimate
will fall back to the old hard-coded minimum priority or
transaction fee.

-paytxfee option overrides -txconfirmtarget.

Relaying and mining code isn't changed.

For Qt, the coin control dialog now uses priority estimates to
label transaction priority (instead of hard-coded constants);
unspent outputs were consistently labeled with a much higher
priority than is justified by the free transactions actually
being accepted into blocks.

I did not implement any GUI for setting -txconfirmtarget; I would
suggest getting rid of the "Pay transaction fee" GUI and replace
it with either "target number of confirmations" or maybe
a "faster confirmation <--> lower fee" slider or select box.
2014-07-03 13:44:33 -04:00
JaSK
a3e192a327 replaced MINE_ with ISMINE_ 2014-07-02 15:48:40 +02:00
JaSK
519dd1c89a Added MINE_ALL = (spendable|watchonly) 2014-07-02 15:48:40 +02:00
JaSK
80dda36a07 removed default argument values for ismine filter 2014-07-02 15:48:39 +02:00
Pieter Wuille
d5087d1ba0 Use script matching rather than destination matching for watch-only.
This changes the keystore data format, wallet format and IsMine logic
to detect watch-only outputs based on direct script matching rather
than first trying to convert outputs to destinations (addresses).

The reason is that we don't know how the software that has the spending
keys works. It may support the same types of scripts as us, but that is
not guaranteed. Furthermore, it removes the ambiguity between addresses
used as identifiers for output scripts or identifiers for public keys.

One practical implication is that adding a normal pay-to-pubkey-hash
address via importaddress will not cause payments to the corresponding
full public key to be detected as IsMine. If that is wanted, add those
scripts directly (importaddress now also accepts any hex-encoded script).

Conflicts:
	src/wallet.cpp
2014-07-02 15:48:39 +02:00
JaSK
952877e01c Showing 'involvesWatchonly' property for transactions returned by 'listtransactions' and 'listsinceblock'.
It is only appended when the transaction involves a watchonly address.
2014-07-02 15:48:38 +02:00
JaSK
d4640d7d8c Added argument to getbalance to include watchonly addresses and fixed errors in balance calculation. 2014-07-02 15:48:38 +02:00
JaSK
ffd40da361 Watchonly balances are shown separately in gui. 2014-07-02 15:48:38 +02:00
Pieter Wuille
c8988460a2 Add support for watch-only addresses
Changes:
* Add Add/Have WatchOnly methods to CKeyStore, and implementations
  in CBasicKeyStore.
* Add similar methods to CWallet, and support entries for it in
  CWalletDB.
* Make IsMine in script/wallet return a new enum 'isminetype',
  rather than a boolean. This allows distinguishing between
  spendable and unspendable coins.
* Add a field fSpendable to COutput (GetAvailableCoins' return type).
* Mark watchonly coins in listunspent as 'watchonly': true.
* Add 'watchonly' to validateaddress, suppressing script/pubkey/...
  in this case.

Based on a patch by Eric Lombrozo.

Conflicts:
	src/qt/walletmodel.cpp
	src/rpcserver.cpp
	src/wallet.cpp
2014-07-02 15:48:37 +02:00
Tom Harding
ada5a067c7 UI to alert of respend attempt affecting wallet.
Respend transactions that conflict with transactions already in the
wallet are added to it.  They are not displayed unless they also involve
the wallet, or get into a block.  If they do not involve the wallet,
they continue not to affect balance.

Transactions that involve the wallet, and have conflicting non-equivalent
transactions, are highlighted in red.  When the conflict first occurs, a
modal dialog is thrown.

CWallet::SyncMetaData is changed to sync only to equivalent transactions.

When a conflict is added to the wallet, counter nConflictsReceived is
incremented.  This acts like a change in active block height for the
purpose of triggering UI updates.
2014-06-27 07:54:21 -07:00