Commit graph

95 commits

Author SHA1 Message Date
Gavin Andresen b25d1c0509 Merge pull request #3679 from laanwj/2014_02_walletpassphrase_behavior
Document new `walletpassphrase` behavior in 0.9
2014-02-17 12:11:13 -05:00
Wladimir J. van der Laan 05add3fe0e Serialize only CTransaction data in gettransaction RPC hex
Don't include trailing implementation-specific wallet metadata.
Fixes 3a1c20b.
2014-02-17 08:53:16 +01:00
Wladimir J. van der Laan b8d9058a4d
Merge pull request #3646
5770254 Copyright header updates s/2013/2014 on files whose last git commit was done in 2014. contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does. (gubatron)
2014-02-16 11:44:48 +01:00
Wladimir J. van der Laan 6c0db81c09 Document new walletpassphrase behavior in 0.9
Also add a note to the release notes.
Fixes #3672.
2014-02-16 10:26:12 +01:00
Gavin Andresen 731b89b8b5 Track and report wallet transaction clones
Adds a "walletconflicts" array to transaction info; if
a wallet transaction is mutated, the alternate transaction id
or ids are reported there (usually the array will be empty).

Metadata from the original transaction is copied to the mutant,
so the transaction time and "from" account of the mutant are
reported correctly.
2014-02-14 18:13:42 -05:00
Gavin Andresen 2b72d46f42 Handle "conflicted" transactions properly
Extend CMerkleTx::GetDepthInMainChain with the concept of
a "conflicted" transaction-- a transaction generated by the wallet
that is not in the main chain or in the mempool, and, therefore,
will likely never be confirmed.

GetDepthInMainChain() now returns -1 for conflicted transactions
(0 for unconfirmed-but-in-the-mempool, and >1 for confirmed).

This makes getbalance, getbalance '*', and listunspent all agree when there are
mutated transactions in the wallet.

Before:
 listunspent: one 49BTC output
 getbalance: 96 BTC (change counted twice)
 getbalance '*': 46 BTC (spends counted twice)

After: all agree, 49 BTC available to spend.
2014-02-14 11:08:40 -05:00
Wladimir J. van der Laan 6056c87d25
Merge pull request #3662
0542619 Rename IsConfirmed to IsTrusted to better match the intended behavior. (Gregory Maxwell)
2014-02-13 20:12:46 +01:00
Wladimir J. van der Laan 3a1c20b77a Add raw transaction hex to gettransaction wallet RPC
This allows getting raw transaction data from the wallet even if the
transaction is no longer in the blockchain / mempool (for example if it
got orphaned due to malleability abuse).
2014-02-13 17:30:00 +01:00
Gregory Maxwell 0542619d93 Rename IsConfirmed to IsTrusted to better match the intended behavior.
This doesn't change the functionality at all.
2014-02-12 16:23:06 -08:00
gubatron 57702541a2 Copyright header updates s/2013/2014 on files whose last git commit was done in 2014.
contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does.
2014-02-09 21:06:06 -05:00
Philip Kaufmann 6943cb9b4f small changes to rpc command help message strings 2014-01-30 14:13:30 +01:00
Wladimir J. van der Laan a7f3aedec3 Re-add BTC/KB in help message for settxfee
Commit a22eed6a got reverted in a RPC documentation update, redo it.
2014-01-29 17:25:04 +01:00
Wladimir J. van der Laan 3cf1f43694 Mention * value for account in documentation for getbalance RPC 2014-01-29 13:43:47 +01:00
Wladimir J. van der Laan a8db31c83d qt: allow walletpassphrase in debug console without -server
Currently it is only possible to use `walletpassphrase` to unlock the
wallet when bitcoin is started in server mode.

Almost everything that manipulates the wallet in the RPC console
needs the wallet to be unlocked and is thus unusable without -server.

This is pretty unintuitive to me, and I'm sure it's even more confusing
to users.

Solve this with a very minimal change: by making the GUI start a
dummy RPC thread just to handle timeouts.
2014-01-17 16:55:20 +01:00
Wladimir J. van der Laan 23981b1f47
Merge pull request #3369
6027b46 Add rpc command 'getunconfirmedbalance' to obtain total unconfirmed balance (Michael Bauer)
2013-12-20 14:43:01 +01:00
Wladimir J. van der Laan c3a7f516e7 Move verifymessage from rpcwallet to rpcmisc
Enables it in --disable-wallet compiles.
2013-12-13 16:34:57 +01:00
Wladimir J. van der Laan 723a03d2de Move createmultisig from rpcwallet to rpcmisc
Enables it in --disable-wallet compiles.
2013-12-13 16:34:57 +01:00
Wladimir J. van der Laan 452955f5be Move validateaddress from rpcwallet to rpcmisc
Enables it in --disable-wallet compiles.
Delimit wallet-using part using #ifdef ENABLE_WALLET.
2013-12-13 16:34:57 +01:00
Wladimir J. van der Laan a943bde6f0 Move settxfee from rpcblockchain to rpcwallet
`settxfee` only affects the wallet, not the block chain.
2013-12-13 16:06:32 +01:00
Philip Kaufmann f914c7a1a4 rpcwallet: use EnsureWalletIsUnlocked() where possible
- replaces a pwalletMain->IsLocked() check
- in keypoolrefill init kpSize to 0 as we have the logic to determine max
  kpSize in pwalletMain->TopUpKeyPool() anyway
2013-12-09 16:19:12 +01:00
Michael Bauer 6027b460e4 Add rpc command 'getunconfirmedbalance' to obtain total unconfirmed balance
Conflicts:
	src/rpcserver.cpp
2013-12-08 18:51:45 +01:00
Wladimir J. van der Laan 991685d3dc Move getinfo to rpcnet.cpp
Where to place `getinfo` is a difficult issue
as it shows information from the wallet, net and
block chain. However, I moved it out of rpcwallet
as the command needs also to be available without
wallet.
2013-12-04 12:46:13 +01:00
Wladimir J. van der Laan bbb093652e Move HelpExample* from rpcwallet to rpcserver
General functions used throughout the RPC framework
don't belong in rpcwallet.
2013-12-04 12:46:12 +01:00
Gavin Andresen 0733c1bde6 Refactor: move GetValueIn(tx) to tx.GetValueIn()
GetValueIn makes more sense as a CTransaction member.
2013-11-30 15:42:10 +10:00
Wladimir J. van der Laan fb78cc2378 Split up bitcoinrpc (code movement only)
Split bitcoinrpc up into

- rpcserver: bitcoind RPC server
- rpcclient: bitcoin-cli RPC client
- rpcprotocol: shared common HTTP/JSON-RPC protocol code

One step towards making bitcoin-cli independent from the rest
of the code, and thus a smaller executable that doesn't have to
be linked against leveldb.

This commit only does code movement, there are no functional changes.
2013-11-27 06:00:29 +01:00
sje a6099ef319 Issue #1865 - Clean up RPC help messages
Based on the proposal, update the help message of rpc methods
- strings arguments are in double quotes rather than square brackets
- numeric arguments have no quotes (and no default value)
- optional parameters are surrounded by round brackets
- json arguments are strings but don't use double quotes

Added 3 sections for the details
- Arguments: lists each argument, it's type, required or not, a default, and a description
- Result: The method result, with json format if applicable, type, and a description
- Examples: examples calls using bitcoin-cli and curl for json rpc call

Problems
- maybe this is too verbose
- lines might be too long
- description are not good or complete
- examples may be too much
2013-11-13 14:54:29 +01:00
Brandon Dahler 51ed9ec971 Cleanup code using forward declarations.
Use misc methods of avoiding unnecesary header includes.
Replace int typedefs with int##_t from stdint.h.
Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h.
Normalize QT_VERSION ifs where possible.
Resolve some indirect dependencies as direct ones.
Remove extern declarations from .cpp files.
2013-11-10 09:36:28 -06:00
Philip Kaufmann 4315ec1a72 RPC: error code changes and prevent crash with walletpassphrase
- fix crash with walletpassphrase by checking if RPC server is running and
  give a friendly error message how to fix this (fixes #3100)
- add 3 new RPCErrorCodes RPC_SERVER_NOT_STARTED, RPC_NODE_ALREADY_ADDED
  and RCP_NODE_NOT_ADDED (I checked the source to not use a number already
  in use for RPC_SERVER_NOT_STARTED)
- use the new codes where needed / missing
- add missing use of RPC_INVALID_PARAMETER
2013-10-24 09:03:02 +02:00
Gavin Andresen 10dc3c7473 Merge branch 'bugfix_unknownoutputs' of git://github.com/luke-jr/bitcoin
Conflicts:
	src/wallet.cpp
Fixed LogPrint/printf merge conflict.
2013-10-22 15:34:11 +10:00
Pieter Wuille 9b1200c23b
Merge pull request #3119
db0e8cc Bump Year Number to 2013 (super3)
2013-10-20 22:25:44 +02:00
super3 db0e8ccd90 Bump Year Number to 2013 2013-10-20 15:25:06 -04:00
Pieter Wuille e4daecda0b Reimplement CBlockLocator's chain-related logic in CChain.
This removes a few unused CBlockLocator methods, and moves the
construction and fork-finding logic to CChain (which can do these
more efficiently, as it has a height-indexable chain available).
It also makes CBlockLocator independent from the validation code.
2013-10-15 11:09:29 +02:00
Pieter Wuille 4c6d41b8b6 Refactor/encapsulate chain globals into a CChain class 2013-10-11 23:25:50 +02:00
Jeff Garzik 28f6b8dbad RPC validateaddress: test pwalletMain for NULL (no-wallet mode) 2013-10-02 05:51:13 -04:00
Jeff Garzik b0730874d9 Support absence of wallet (pwalletMain==NULL) in several locations,
notably RPC.
2013-10-01 16:14:37 -04:00
Peter Todd 2253642287
Make validateaddress provide redeemScript 2013-09-12 22:54:43 -04:00
Gregory Maxwell dd30937ce3 Merge pull request #2948 from jgarzik/changeaddr
RPC: add getrawchangeaddress, for raw transaction change destinations
2013-09-02 20:29:02 -07:00
Jeff Garzik e5e9904c1c RPC: add getrawchangeaddress, for raw transaction change destinations 2013-08-28 16:29:52 -04:00
Gregory Maxwell 71ac5052d8 Remove fAllowReuse from GetKeyFromPool.
With the GUI password fix this was always false.
2013-08-23 12:54:50 -07:00
Gavin Andresen a41d5fe019 Payment Protocol: X509-validated payment requests
Add support for a Payment Protocol to Bitcoin-Qt.

Payment messages are protocol-buffer encoded and communicated over
http(s), so this adds a dependency on the Google protocol buffer
library, and requires Qt with OpenSSL support.
2013-08-22 16:18:25 +10:00
Gavin Andresen 3624356e82 Refactor: Move GetAccountAddresses to CWallet 2013-08-22 11:05:45 +10:00
Gavin Andresen 618855133d Refactor: CAddressBookData for mapAddressBook
Straight refactor, so mapAddressBook stores a CAddressBookData
(which just contains a std::string) instead of a std::string.

Preparation for payment protocol work, which will add the notion
of refund addresses to the address book.
2013-08-22 11:05:45 +10:00
Micha 9afe5a2c32 Clarified the listsinceblock help test
Specifically, the fact that the command
relates to wallet transactions.
2013-08-16 00:15:39 +03:00
Gavin Andresen 4323bfeafd Merge pull request #2776 from jgarzik/keypoolsize
RPC: keypoolrefill now permits optional size parameter, to bump keypool
2013-08-14 22:01:22 -07:00
Han Lin Yap 1511769239 Use existing RPC_INVALID_PARAMETER constant 2013-08-07 10:14:33 +02:00
Luke Dashjr cc6cfab38f Bugfix: Supress "address" key in transaction details, when the destination isn't recognized
Previously, it would pass corrupt/random through base58.
2013-07-17 03:05:38 +00:00
Jeff Garzik 36bd46f1c4 RPC: keypoolrefill gains optional size parameter 2013-06-25 16:21:42 -04:00
Jeff Garzik 13dd2d090e CWallet::TopUpKeyPool() takes optional pool size argument
Also, GetKeyPoolSize() now returns an accurate type, unsigned int.
2013-06-25 16:07:29 -04:00
Mike Hearn 0e4b317555 Introduce a CChainParameters singleton class and regtest mode.
The new class is accessed via the Params() method and holds
most things that vary between main, test and regtest networks.
The regtest mode has two purposes, one is to run the
bitcoind/bitcoinj comparison tool which compares two separate
implementations of the Bitcoin protocol looking for divergence.

The other is that when run, you get a local node which can mine
a single block instantly, which is highly convenient for testing
apps during development as there's no need to wait 10 minutes for
a block on the testnet.
2013-06-19 16:28:52 +02:00
Eric Lombrozo 05df3fc68d Removed AcceptToMemoryPool method from CTransaction. This method belongs to the mempool instance.
Removed AreInputsStandard from CTransaction, made it a regular function in main.
Moved CTransaction::GetOutputFor to CCoinsViewCache.

Moved GetLegacySigOpCount and GetP2SHSigOpCount out of CTransaction into regular functions in main.

Moved GetValueIn and HaveInputs from CTransaction into CCoinsViewCache.

Moved AllowFree, ClientCheckInputs, CheckInputs, UpdateCoins, and CheckTransaction out of CTransaction and into main.

Moved IsStandard and IsFinal out of CTransaction and put them in main as IsStandardTx and IsFinalTx. Moved GetValueOut out of CTransaction into main. Moved CTxIn, CTxOut, and CTransaction into core.

Added minimum fee parameter to CTxOut::IsDust() temporarily until CTransaction is moved to core.h so that CTxOut needn't know about CTransaction.
2013-06-05 23:15:20 -07:00