Commit graph

312 commits

Author SHA1 Message Date
Gavin Andresen eaf00a3a5d Merge pull request #1774 from luke-jr/refactor_times
Bugfix: Require OrderedTxItems to provide properly scoped accounting entry list
2012-09-02 16:47:58 -07:00
Luke Dashjr ddb709e9de Bugfix: Require OrderedTxItems to provide properly scoped accounting entry list
OrderedTxItems returns a multimap of pointers, but needs a place to store the actual CAccountingEntries it points to.
It had been using a stack item, which was clobbered as soon as it returned, resulting in undefined behaviour.
This fixes at least bug #1768.
2012-09-02 08:02:46 +00:00
Wladimir J. van der Laan 4d1d94c56c Rename CreateThread to NewThread
Prevent clash with win32 API symbol
2012-08-29 20:25:37 +02:00
Gregory Maxwell c68c4bc7a4 Merge pull request #1672 from gmaxwell/filter_listunspent
Listunspent txout address filtering and listaddressgroupings
2012-08-24 00:46:24 -07:00
Gregory Maxwell b1093efa83 Change CWallet addressgrouping to use CTxDestination instead of strings.
This is cleanup for the listaddressgroupings code. Also add some
real help text.
2012-08-24 03:28:45 -04:00
Philip Kaufmann f09e8fcd33 Qt: show mined transactions at depth 1
- before, we used to show them in GUI when depth >= 2, which could lead to
  confusion of users, as the RPC behaviour already showed the Tx
2012-08-24 08:52:12 +02:00
Luke Dashjr e07c8e9123 Treat generation (mined) transactions less different from receive transactions
- Show address receiving the generation, and include it in the correct "account"
- Multiple entries in listtransactions output if the coinbase has multiple outputs to us
2012-08-23 23:20:01 +00:00
coderrr 22dfd73598 Add address groupings RPC from the coincontrol patches.
Signed-off-by: Gregory Maxwell <greg@xiph.org>
2012-08-23 15:55:42 -04:00
Luke Dashjr c3f95ef13f Choose reasonable "smart" times to display for transactions
Logic:
- If sending a transaction, assign its timestamp to the current time.
- If receiving a transaction outside a block, assign its timestamp to the current time.
- If receiving a block with a future timestamp, assign all its (not already known) transactions' timestamps to the current time.
- If receiving a block with a past timestamp, before the most recent known transaction (that we care about), assign all its (not already known) transactions' timestamps to the same timestamp as that most-recent-known transaction.
- If receiving a block with a past timestamp, but after the most recent known transaction, assign all its (not already known) transactions' timestamps to the block time.
2012-08-23 18:38:22 +00:00
Luke Dashjr 9c7722b7c5 Store a fixed order of transactions (and accounting) in the wallet
For backward compatibility, new accounting data is stored after a \0 in the comment string.
This way, old versions and third-party software should load and store them, but all actual use (listtransactions, for example) ignores it.
2012-08-23 18:18:20 +00:00
xanatos b765385a3e Removed useless assignment
nLoadWalletRet is already equal to DB_NEED_REWRITE (we are in an if)
2012-08-23 14:47:00 +03:00
Jeff Garzik f81e6f779b Merge pull request #1632 from luke-jr/spelling
Fix spelling and grammar errors
2012-08-01 10:56:47 -07:00
Luke Dashjr 814efd6f1f Bugfix: Fix a variety of misspellings 2012-08-01 17:49:51 +00:00
Philip Kaufmann e6bc9c35f3 Update Warning-strings to use a standard-format
- ensure warnings always start with "Warning:" and that the first
  character after ":" is written uppercase
- ensure the first sentence in warnings ends with an "!"
- remove unneeded spaces from Warning-strings
- add missing Warning-string translation
- remove a "\n" and replace with untranslatable "<br><br>"
2012-08-01 19:33:32 +02:00
Gavin Andresen a2709fad7f Implement raw transaction RPC calls
Implement listunspent / getrawtransaction / createrawtransaction /
signrawtransaction, to support creation and
signing-on-multiple-device multisignature transactions.
2012-07-05 12:50:09 -04:00
Chris Moore 831f59ce8b Fix coin selection to only include change when it's necessary. 2012-06-04 16:49:10 +00:00
Chris Moore d650f96d5f Preserve the shuffled order of coins with equal value to give more randomized coin selection. 2012-06-04 16:36:46 +00:00
Chris Moore e333ab56d5 Move the random_shuffle call back into SelectCoinsMinConf() so we can unit test it. 2012-06-04 16:36:39 +00:00
Chris Moore 9b0369c773 Refactor SelectCoinsMinConf() and add unit tests.
AvailableCoins() makes a vector of available outputs which is then passed to SelectCoinsMinConf().  This allows unit tests to test the coin selection algorithm without having the whole blockchain available.
2012-06-04 16:36:34 +00:00
Wladimir J. van der Laan 882ba0e752 Merge pull request #837 from sje397/ShowImmatureBalance
Added 'immature balance' for miners. Only displayed if the balance is > 0
2012-06-02 02:35:48 -07:00
sje397 8fdb7e108f Added 'immature balance' for miners. Only displayed if the balance is greater than zero.
This adds a field labelled 'Immature' in the overview section under the 'unconfirmed' field, which shows mined
income that has not yet matured (which is currently not displayed anywhere, even though the transactions
exist in the transaction list). To do that I added a 'GetImmatureBalance' method to the wallet, and connected
that through to the GUI as per the 'GetBalance' and 'GetUnconfirmedBalance' methods. I did a small 'no-op'
change to make the code in adjacent functions a little more readable (imo); it was a change I had made in my
repo earlier...but I thought it wouldn't hurt so left it in. Immature balance comes from mined income that is
at least two blocks deep in the chain (same logic as displayed transactions).

My reasoning is:
- as a miner, it's a critical stat I want to see
- as a miner, and taking into account the label 'immature', the uncertainty is pretty clearly implied
- those numbers are already displayed in the transaction list
- this makes the overview numbers add up to what's in the transaction list
- it's not displayed if the immature balance is 0, so won't bother non-miners

I also 'cleaned' the overview UI a little, moving code to the XML and removing HTML.
2012-05-25 23:15:27 +10:00
Pieter Wuille 1025440184 Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddress
This introduces internal types:
* CKeyID: reference (hash160) of a key
* CScriptID: reference (hash160) of a script
* CTxDestination: a boost::variant of the former two

CBitcoinAddress is retrofitted to be a Base58 encoding of a
CTxDestination. This allows all internal code to only use the
internal types, and only have RPC and GUI depend on the base58 code.

Furthermore, the header dependencies are a lot saner now. base58.h is
at the top (right below rpc and gui) instead of at the bottom. For the
rest: wallet -> script -> keystore -> key. Only keystore still requires
a forward declaration of CScript. Solving that would require splitting
script into two layers.
2012-05-24 20:26:19 +02:00
Pieter Wuille fd61d6f506 Encapsulate public keys in CPubKey 2012-05-24 19:58:12 +02:00
Pieter Wuille 46784d0826 Merge pull request #1354 from fanquake/master
Update Header Licenses
2012-05-20 12:27:50 -07:00
Wladimir J. van der Laan 0832c0d166 Process address book updates incrementally
- No longer invalidates selection model, thus retains selection on address book changes
- Fixes selection of new address when added
2012-05-20 10:44:50 +02:00
Wladimir J. van der Laan ab1b288fa7 Convert UI interface to boost::signals2.
- Signals now go directly from the core to WalletModel/ClientModel.
  - WalletModel subscribes to signals on CWallet: Prepares for multi-wallet support, by no longer assuming an implicit global wallet.
- Gets rid of noui.cpp, the few lines that were left are merged into init.cpp
- Rename wxXXX message flags to MF_XXX, to make them UI indifferent.
- ThreadSafeMessageBox no longer returns the value `4` which was never used, converted to void.
2012-05-20 10:44:50 +02:00
Wladimir J. van der Laan fe4a655042 Fine-grained UI updates
Gets rid of `MainFrameRepaint` in favor of specific update functions that tell the UI exactly what changed.

This improves the efficiency of various handlers. Also fixes problems with mined transactions not showing up until restart.

The following notifications were added:

- `NotifyBlocksChanged`: Block chain changed
- `NotifyKeyStoreStatusChanged`: Wallet status (encrypted, locked) changed.
- `NotifyAddressBookChanged`: Address book entry changed.
- `NotifyTransactionChanged`: Wallet transaction added, removed or updated.
- `NotifyNumConnectionsChanged`: Number of connections changed.
- `NotifyAlertChanged`: New, updated or cancelled alert. As this finally makes it possible for the UI to know when a new alert arrived, it can be shown as OS notification.

These notifications could also be useful for RPC clients. However, currently, they are ignored in bitcoind (in noui.cpp).

Also brings back polling with timer for numBlocks in ClientModel. This value updates so frequently during initial download that the number of signals clogs the UI thread and causes heavy CPU usage. And after initial block download, the value changes so rarely that a delay of half a second until the UI updates is unnoticable.
2012-05-20 10:41:54 +02:00
Philip Kaufmann ff0ee876bb change strings to Bitcoin (uppercase), where it is used as a noun and update strings to use "Qt" (and not qt or QT) / update initialisation of notificator to use qApp->applicationName() instead of a static string 2012-05-18 23:13:58 +02:00
Fordy 3a25a2b9b0 Update License in File Headers
I originally created a pull to replace the "COPYING" in crypter.cpp and
crypter.h, but it turned out that COPYING was actually the correct
file.
2012-05-18 22:02:28 +08:00
Jeff Garzik 0fb78eae34 Always check return values of TxnBegin() and TxnCommit() 2012-05-14 01:11:11 -04:00
Jeff Garzik faf705a42a Prefer 'unsigned int' for loop index variables tested against ::size()
C++ STL ::size() generally returns unsigned, which implies that "int idx"
style of loop variable will generate a signed-vs-unsigned comparison warning
when testing the loop exit condition "idx < blah.size()"

Update areas of the bitcoin code where loop variables may be more properly and
correctly defined as unsigned.
2012-04-22 13:22:39 -04:00
Pieter Wuille 6b6aaa1698 Further reduce header dependencies
This commit removes the dependency of serialize.h on PROTOCOL_VERSION,
and makes this parameter required instead of implicit. This is much saner,
as it makes the places where changing a version number can have an
influence obvious.
2012-04-17 20:03:42 +02:00
Jeff Garzik 9eace6b113 Move CWalletDB code to new walletdb module.
In addition to standard code separation, this change opens the door
to fixing several include inter-dependencies.
2012-04-17 20:00:55 +02:00
Pieter Wuille ed6d0b5f85 Remove headers.h 2012-04-17 20:00:55 +02:00
Jeff Garzik c376ac359e Fix loop index var types, fixing many minor sign comparison warnings
foo.size() typically returns an unsigned integral type; make loop variables
match those types' signedness.
2012-04-15 16:52:09 -04:00
Wladimir J. van der Laan da7bbd9dfd fix warnings: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] 2012-04-15 13:40:14 +02:00
Pieter Wuille f8dcd5ca6f Use scoped locks instead of CRITICAL_BLOCK 2012-04-09 01:59:46 +02:00
Wladimir J. van der Laan 7cfbe1fee4 qtui.h/noui.h interface cleanup
- rename wxMessageBox, remove redundant arguments to noui/qtui calls
- also, add flag to force blocking, modal dialog box for disk space warning etc
- clarify function naming
- no more special MessageBox needed from AppInit2, as window object is created before calling AppInit2
2012-04-04 09:37:25 +02:00
Wladimir J. van der Laan 98e6175874 Update UI through async calls MainFrameRepaint and AddressBookRepaint instead of a timer.
- Overall, this is better design
- This fixes problems with the address book UI not updating when the address book is changed through RPC
- Move Statusbar change detection responsibility to ClientModel
2012-04-04 09:35:01 +02:00
Pieter Wuille 439e1497e1 Introduce explicit -walletupgrade option
Do not automatically change the wallet format unless the user takes an
explicit action that implies an upgrade (encrypting, for now), or uses
-walletupgrade.

-walletupgrade optionally takes an integer argument: the client version
up to which upgrading is allowed. Without an argument, it is upgraded
to latest supported version. If an argument to -walletupgrade is
provided at the time the wallet is created, the new wallet will initially
not use features beyond that version.

Third, the current wallet version number is reported in getinfo.
2012-03-22 23:47:29 +01:00
Pieter Wuille 3a4d81724e Merge pull request #864 from sipa/fix_856
Make compressed pubkeys require client >=0.5.99
2012-02-19 18:21:19 -08:00
Pieter Wuille fcfd7ff8f8 Free pwalletdbEncryption after encryping wallet
Fixes a memory leak.
2012-02-18 15:44:34 +01:00
Pieter Wuille 38067c18f8 Make compressed pubkeys require 0.6.0 2012-02-18 15:42:38 +01:00
Pieter Wuille 9976cf070f Move GenerateNewKey back to CWallet 2012-02-18 15:42:38 +01:00
Pieter Wuille 0b807a417f Add SetMinVersion to CWallet 2012-02-18 15:42:29 +01:00
Gavin Andresen 882164196e Update all copyrights to 2012 2012-02-07 11:28:30 -05:00
Gavin Andresen 922e8e2929 Replace OP_EVAL (BIP 12) with Pay-to-script-hash (BIP 16). 2012-01-13 10:22:23 -05:00
Gavin Andresen 2e17ac83c6 Fix broken ExtractAddress (refactored, made callers check for addresses in keystore if they care) 2011-12-22 15:57:31 -05:00
Wladimir J. van der Laan bde280b9a4 Revert "Use standard C99 (and Qt) types for 64-bit integers"
This reverts commit 21d9f36781.
2011-12-21 22:33:19 +01:00
Luke Dashjr 21d9f36781 Use standard C99 (and Qt) types for 64-bit integers 2011-12-20 16:52:59 -05:00
Gavin Andresen 781c06c0f5 Merge pull request #677 from luke-jr/minfee_modes
API: GetMinFee modes
2011-12-20 13:09:18 -08:00
Gavin Andresen 595925592d Merge branch 'op_eval' 2011-12-20 14:43:31 -05:00
Gavin Andresen 26ce92b352 Use std::numeric_limits<> for typesafe INT_MAX/etc 2011-12-19 19:10:34 -05:00
Gavin Andresen be237c119e Fix logic for IsChange() for send-to-self transactions. 2011-12-19 13:24:49 -05:00
Gavin Andresen 2a45a494b0 Use block times for 'hard' OP_EVAL switchover, and refactored EvalScript
so it takes a flag for how to interpret OP_EVAL.
Also increased IsStandard size of scriptSigs to 500 bytes, so
a 3-of-3 multisig transaction IsStandard.
2011-12-19 13:24:48 -05:00
Gavin Andresen e679ec969c OP_EVAL implementation
OP_EVAL is a new opcode that evaluates an item on the stack as a script.
It enables a new type of bitcoin address that needs an arbitrarily
complex script to redeem.
2011-12-19 12:40:19 -05:00
Gavin Andresen bf798734db Support 3 new multisignature IsStandard transactions
Initial support for (a and b), (a or b), and 2-of-3 escrow
transactions (where a, b, and c are keys).
2011-12-19 12:40:19 -05:00
Pieter Wuille 95d888a6d1 Key import and export
Introduces two new RPC calls:
* dumpprivkey: retrieve the private key corresponding to an address
* importprivkey: add a private key to your wallet

The private key format is analoguous to the address format. It is
a 51-character base58-encoded string, that includes a version number
and a checksum.

Includes patch by mhanne:
* add optional account parameter for importprivkey, if omitted use default
2011-12-17 21:49:48 +01:00
Pieter Wuille 30ab2c9c46 Preparations for key import/export 2011-12-17 21:49:48 +01:00
Pieter Wuille 4c6e22953e Make CWalletTx::pwallet private 2011-12-17 21:49:47 +01:00
Luke Dashjr dbbf1d4a48 GetMinFee takes a mode parameter (GMF_{BLOCK,RELAY,SEND}) instead of fForRelay 2011-12-14 01:07:43 -05:00
Dylan Noblesmith 94f778bdeb Implement an mlock()'d string class for storing passphrases
SecureString is identical to std::string except with secure_allocator
substituting for std::allocator. This makes casting between them
impossible, so converting between the two at API boundaries requires
calling ::c_str() for now.
2011-11-26 06:02:04 +00:00
Gavin Andresen b2d3b2d65d Never remove database files on shutdown, it caused unreadable wallets on some testers' machines. 2011-11-20 10:39:01 -05:00
Gavin Andresen 1c15f88653 Only remove database log files on shutdown after wallet encryption/rewrite 2011-11-17 14:21:32 -05:00
Gavin Andresen 37971fcc76 Create new keypool for newly encrypted wallets. 2011-11-17 14:01:25 -05:00
Gavin Andresen d764d9161e Obsolete keypool and make sure database removes log files on shutdown. 2011-11-15 09:30:16 -05:00
Pieter Wuille 9e9869d0fe Resilvering 2011-11-14 09:59:22 -05:00
Pieter Wuille d825e6a31b Some extra comments 2011-11-07 00:11:34 +01:00
Matt Corallo 0767e69199 Add returns to avoid annoying compile-time warnings. 2011-10-25 11:40:59 -04:00
Nils Schneider 6ccff2cbde remove cryptopp dependency, add simple unittest for SHA256Transform() 2011-09-30 20:00:22 +02:00
Wladimir J. van der Laan c5aa1b139a update to work with new lock system, add protocol.* to build system 2011-09-02 18:02:22 +02:00
Wladimir J. van der Laan 7a15d4ff67 Merge branch 'master' of https://github.com/bitcoin/bitcoin
Conflicts:
	src/main.cpp
2011-09-02 17:35:30 +02:00
Gavin Andresen ed02c95d50 obtain cs_wallet mutex to protect vchDefaultKey 2011-09-01 10:58:08 -04:00
Gavin Andresen 7db3b75b3e Logic running with -keypool=0 was wrong (empty keys were being returned). Fixes #445
Renames GetOrReuseKeyFromKeyPool to GetKeyFromPool, with fAllowReuse arg and bool result.
2011-09-01 10:12:59 -04:00
Gavin Andresen 471426fb3b Fixed potential deadlocks in GUI code.
Also changed semantics of CWalletTx::GetTxTime(); now always returns the time the transaction was received by this node, not the average block time.
And added information about -DDEBUG_LOCKORDER to coding.txt.
2011-08-31 12:55:16 -04:00
Gavin Andresen 6cc4a62c0e Fix rpc-hanging deadlocks
Collapsed multiple wallet mutexes to a single cs_wallet, to avoid deadlocks with wallet methods that acquired locks in different order.
Also change master RPC call handler to acquire cs_main and cs_wallet locks before executing RPC calls; requiring each RPC call to acquire the right set of locks in the right order was too error-prone.
2011-08-31 12:55:16 -04:00
Wladimir J. van der Laan b90c9ecb13 Merge branch 'master' of https://github.com/bitcoin/bitcoin 2011-08-16 10:28:24 +02:00
Matt Corallo b2120e223a Unify copyright notices.
To a variation on:
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2011 The Bitcoin developers
2011-08-09 13:32:52 +02:00
Wladimir J. van der Laan b5b1d1a66b Merge branch 'master' of https://github.com/bitcoin/bitcoin
Conflicts:
	src/script.cpp
2011-07-27 21:44:55 +02:00
Pieter Wuille b63241d451 Bugfix: don't overuse limited ExtractAddress
ExtractAddress was called with the keystore as argument in RPC and
UI, limiting results to own keys. This caused empty "address"
fields.
2011-07-26 19:41:47 +02:00
Wladimir J. van der Laan 491ad6db50 Merge remote branch 'upstream/master'
Conflicts:
	src/bitcoinrpc.cpp
2011-07-26 16:47:23 +02:00
Jeff Garzik a9ba47101a Merge pull request #403 from sipa/cbitcoinaddress
keys indexed by address + introduced CBitcoinaddress
2011-07-24 15:38:38 -07:00
Pieter Wuille a7dd11c6da Fix for small change outputs
With the separation of CENT and MIN_TX_FEE, it is now reasonable
to create change outputs between 0.01 and 0.0005, as these are
spendable according to the policy, even though they require a fee
to be paid.

Also, when enough fee was already present, everything can go into
a change output, without further increasing the fee.
2011-07-24 16:37:09 +02:00
Pieter Wuille 2ffba736e9 Use CBitcoinAddress instead of string/uint160
Instead of conversion functions between pubkey/uint160/address in
base58.h, have a fully fledged class CBitcoinAddress (CAddress was
already taken) to represent addresses.
2011-07-17 12:09:14 +02:00
Pieter Wuille 03fbd79049 get rid of mapPubKeys
Make CKeyStore's interface work on uint160's instead of pubkeys, so
no separate global mapPubKeys is necessary anymore.
2011-07-17 12:07:59 +02:00
Wladimir J. van der Laan d421117620 Merge branch 'master' of https://github.com/bitcoin/bitcoin 2011-07-15 16:42:44 +02:00
Matt Corallo a2606bad09 Fix Build in GetReservedKey() in wallet.cpp 2011-07-14 03:34:07 +02:00
Matt Corallo cee69980b0 Generate Warning when using default key. 2011-07-14 03:28:31 +02:00
Matt Corallo 0d7b28e52e Fix crashes when a wallet is locked and GetReservedKey() is called 2011-07-14 03:11:40 +02:00
Jeff Garzik 9cd22ab862 Merge pull request #406 from muggenhor/warning-fixes
Warning fixes
2011-07-13 08:55:49 -07:00
Giel van Schijndel 84c3c2ebe7 fix warning: control reaches end of non-void function [-Wreturn-type]
Signed-off-by: Giel van Schijndel <me@mortis.eu>
2011-07-13 14:25:45 +02:00
Pieter Wuille d5115a71a1 Bugfix: add autogenerated addresses to address book 2011-07-13 13:05:08 +02:00
Jeff Garzik 116df55e21 Update CWallet::LoadWallet for proper return type. 2011-07-13 01:07:49 -04:00
Giel van Schijndel 858cebed7d fix warning: unused variable 'X' [-Wunused-variable]
Remove several unused variables.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2011-07-13 05:10:15 +02:00
Jeff Garzik 0fa89d8e81 Merge pull request #381 from TheBlueMatt/nminversion
Add minversion to wallet.
2011-07-12 19:34:30 -07:00
Matt Corallo 7414733bea Make an invalid addrIncoming so that old clients crash.
This prevents old clients from opening, and thus corrupting
or otherwise causing harm to encrypted wallets.
2011-07-13 02:11:25 +02:00
Matt Corallo 96f34cd5c4 Use DB Transactions when encrypting wallet.
This speeds up the encryption process significantly.
2011-07-13 02:11:25 +02:00
Matt Corallo ddebdd9a8f Set the number of SHA512 rounds based on the speed of the computer. 2011-07-13 02:11:25 +02:00
Matt Corallo 4e87d341f7 Add wallet privkey encryption.
This commit adds support for ckeys, or enCrypted private keys, to the wallet.
All keys are stored in memory in their encrypted form and thus the passphrase
is required from the user to spend coins, or to create new addresses.

Keys are encrypted with AES-256-CBC using OpenSSL's EVP library. The key is
calculated via EVP_BytesToKey using SHA512 with (by default) 25000 rounds and
a random salt.

By default, the user's wallet remains unencrypted until they call the RPC
command encryptwallet <passphrase> or, from the GUI menu, Options->
Encrypt Wallet.

When the user is attempting to call RPC functions which require the password
to unlock the wallet, an error will be returned unless they call
walletpassphrase <passphrase> <time to keep key in memory> first.

A keypoolrefill command has been added which tops up the users keypool
(requiring the passphrase via walletpassphrase first).
keypoolsize has been added to the output of getinfo to show the user the
number of keys left before they need to specify their passphrase (and call
keypoolrefill).

Note that walletpassphrase will automatically fill keypool in a separate
thread which it spawns when the passphrase is set. This could cause some
delays in other threads waiting for locks on the wallet passphrase, including
one which could cause the passphrase to be stored longer than expected,
however it will not allow the passphrase to be used longer than expected as
ThreadCleanWalletPassphrase will attempt to get a lock on the key as soon
as the specified lock time has arrived.

When the keypool runs out (and wallet is locked) GetOrReuseKeyFromPool
returns vchDefaultKey, meaning miners may start to generate many blocks to
vchDefaultKey instead of a new key each time.

A walletpassphrasechange <oldpassphrase> <newpassphrase> has been added to
allow the user to change their password via RPC.

Whenever keying material (unencrypted private keys, the user's passphrase,
the wallet's AES key) is stored unencrypted in memory, any reasonable attempt
is made to mlock/VirtualLock that memory before storing the keying material.
This is not true in several (commented) cases where mlock/VirtualLocking the
memory is not possible.

Although encryption of private keys in memory can be very useful on desktop
systems (as some small amount of protection against stupid viruses), on an
RPC server, the password is entered fairly insecurely. Thus, the only main
advantage encryption has for RPC servers is for RPC servers that do not spend
coins, except in rare cases, eg. a webserver of a merchant which only receives
payment except for cases of manual intervention.

Thanks to jgarzik for the original patch and sipa, gmaxwell and many others
for all their input.

Conflicts:

	src/wallet.cpp
2011-07-13 02:11:25 +02:00
Wladimir J. van der Laan df5ccbd2b2 Show unconfirmed balance on overview page 2011-07-11 20:42:10 +02:00
Pieter Wuille acd6501610 Prepare codebase for Encrypted Keys. 2011-07-08 15:46:47 +02:00
Wladimir J. van der Laan ae3d0aba15 Sync to bitcoin git e94010b239 2011-07-07 15:22:54 +02:00
Matt Corallo 7ec552676c Add minversion to wallet. 2011-07-05 18:36:01 +02:00
Pieter Wuille e9f61c8787 Fix synchronization of default key 2011-07-05 17:42:44 +02:00
Wladimir J. van der Laan b8f174a5ce as there is no "default receiving address" in this GUI, don't autogenerate new addresses on receiving 2011-07-04 20:12:58 +02:00
Stéphane Gimenez 4d410cfce9 Fix AddressBook syncrhonization between a CWallet and CWalletDB
This problem was reported independently by laanwj in Issue #350.
2011-06-27 23:22:30 +02:00
Wladimir J. van der Laan e8ef3da713 update core to d0d80170a2 (CWallet class) 2011-06-26 19:23:24 +02:00
Pieter Wuille d3800d59d5 Fix segfault when creating new wallet
The initialization of the default key used keyUser instead
of vchDefaultKey. keyUser is now complete removed.
2011-06-26 02:37:52 +02:00
Pieter Wuille 98705aa51c Bugfixes walletclass
Some problems found by ius:
* compiler complains with no return after critical section block
* CKeyStore::GetPrivKey(key) was undefined for unknown key
* missing return statement in GetChange()
2011-06-20 20:07:28 +02:00
Jeff Garzik aa0c5e87e8 CWalletTx::GetAmounts(): pass NULL for CKeyStore*, rather than false
to fix warning.
2011-06-18 21:50:05 -04:00
Pieter Wuille 64c7ee7e6b CWallet class
* A new class CKeyStore manages private keys, and script.cpp depends on access to CKeyStore.
* A new class CWallet extends CKeyStore, and contains all former wallet-specific globals; CWallet depends on script.cpp, not the other way around.
* Wallet-specific functions in CTransaction/CTxIn/CTxOut (GetDebit, GetCredit, GetChange, IsMine, IsFromMe), are moved to CWallet, taking their former 'this' argument as an explicit parameter
* CWalletTx objects know which CWallet they belong to, for convenience, so they have their own direct (and caching) GetDebit/... functions.
* Some code was moved from CWalletDB to CWallet, such as handling of reserve keys.
* Main.cpp keeps a set of all 'registered' wallets, which should be informed about updates to the block chain, and does not have any notion about any 'main' wallet. Function in main.cpp that require a wallet (such as GenerateCoins), take an explicit CWallet* argument.
* The actual CWallet instance used by the application is defined in init.cpp as "CWallet* pwalletMain". rpc.cpp and ui.cpp use this variable.
* Functions in main.cpp and db.cpp that are not used by other modules are marked static.
* The code for handling the 'submitorder' message is removed, as it not really compatible with the idea that a node is independent from the wallet(s) connected to it, and obsolete anyway.
2011-06-15 11:05:55 +02:00
Pieter Wuille e89b9f6a2a move wallet code to separate file
This introduces two new source files, keystore.cpp and wallet.cpp with
corresponding headers. Code is moved from main and db, in a preparation
for a follow-up commit which introduces the classes CWallet and CKeyStore.
2011-06-15 11:05:55 +02:00