Commit graph

8785 commits

Author SHA1 Message Date
dexX7 506bae3ac9
Return all available information via validateaddress
`"validateaddress"` omits some information, even in cases where is it available.

The primary motivation is to be able to retrieve redeemScripts, after using `"addmultisigaddress"`, when not all keys are available in the keystore, but the redeemScript actually is.

The output of `"validateaddress"` with this commit:

Keys not available:
```js
validateaddress "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3"
{
  "isvalid": true,
  "address": "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3",
  "scriptPubKey": "76a914fa20d564550b105787f7ce3a9ad7fd9a45cd407088ac",
  "ismine": false,
  "iswatchonly": false,
  "isscript": false
}
```
```js
validateaddress "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK"
{
  "isvalid": true,
  "address": "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK",
  "scriptPubKey": "a9146769c19a16c9400b908756e19a4d2afb9e9760e187",
  "ismine": false,
  "iswatchonly": false,
  "isscript": true
}
```

After adding the redeemScript:
```js
addmultisigaddress 2 '["02537357B156A33306A7A014A3748631C59DF405B56F11BA4AA4A3CE81501AF095","02F1FB200390E7864EF4450C07B15988179A57C3CF3A878F668E1070CB615749FE"]'
2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK

validateaddress "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK"
{
  "isvalid": true,
  "address": "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK",
  "scriptPubKey": "a9146769c19a16c9400b908756e19a4d2afb9e9760e187",
  "ismine": false,
  "iswatchonly": false,
  "isscript": true,
  "script": "multisig",
  "hex": "522102537357b156a33306a7a014a3748631c59df405b56f11ba4aa4a3ce81501af0952102f1fb200390e7864ef4450c07b15988179a57c3cf3a878f668e1070cb615749fe52ae",
  "addresses": [
    "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3",
    "mmSKNtbYYHRrhTLKiok5TuYrGEs4Y2A4k6"
  ],
  "sigsrequired": 2,
  "account": ""
}
```

All keys available:
```js
validateaddress "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3"
{
  "isvalid": true,
  "address": "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3",
  "scriptPubKey": "76a914fa20d564550b105787f7ce3a9ad7fd9a45cd407088ac",
  "ismine": true,
  "iswatchonly": false,
  "isscript": false,
  "pubkey": "02537357b156a33306a7a014a3748631c59df405b56f11ba4aa4a3ce81501af095",
  "iscompressed": true,
  "account": ""
}
```
```js
validateaddress "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK"
{
  "isvalid": true,
  "address": "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK",
  "scriptPubKey": "a9146769c19a16c9400b908756e19a4d2afb9e9760e187",
  "ismine": true,
  "iswatchonly": false,
  "isscript": true,
  "script": "multisig",
  "hex": "522102537357b156a33306a7a014a3748631c59df405b56f11ba4aa4a3ce81501af0952102f1fb200390e7864ef4450c07b15988179a57c3cf3a878f668e1070cb615749fe52ae",
  "addresses": [
    "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3",
    "mmSKNtbYYHRrhTLKiok5TuYrGEs4Y2A4k6"
  ],
  "sigsrequired": 2,
  "account": ""
}
```
2015-06-09 17:21:27 +02:00
Wladimir J. van der Laan c57e12aeef
Merge pull request #6217
51fc672 [Qt] disconnect peers from peers tab via context menu (Philip Kaufmann)
2015-06-09 17:13:29 +02:00
Wladimir J. van der Laan defa4fc25c
Merge pull request #6249
cab580d gitian: Add petertodd to gitian download scripts (Peter Todd)
2015-06-09 14:21:39 +02:00
Wladimir J. van der Laan 40cfa57279
Merge pull request #6250
789b7c3 gitian-downloader: Add prab's key (Paul Rabahy)
2015-06-09 14:21:06 +02:00
Gavin Andresen 65b9454503
Use best header chain timestamps to detect partitioning
The partition checking code was using chainActive timestamps
to detect partitioning; with headers-first syncing, it should use
(and with this pull request, does use) pIndexBestHeader timestamps.

Fixes issue #6251
2015-06-08 16:34:58 -04:00
Paul Rabahy 789b7c34b8
gitian-downloader: Add prab's key 2015-06-07 22:48:29 -04:00
Peter Todd cab580d62e
gitian: Add petertodd to gitian download scripts 2015-06-07 20:10:51 -04:00
Andriy Voskoboinyk 0640a5eb60 Add an alternate location of endian.h header 2015-06-07 04:54:20 +03:00
Luke Dashjr a5a81f7354 configure: Detect (and reject) LibreSSL 2015-06-06 14:23:38 +00:00
Wladimir J. van der Laan 55294a9fb6
Merge pull request #6241
c946ebe fix util_tests.cpp clang warnings (Jonas Schnelli)
2015-06-06 11:31:55 +02:00
Wladimir J. van der Laan 606ba62d88
Merge pull request #6232
f053bd2 Add erkmos OpenPGP key to gitian downloader keyset (Erik Mossberg)
2015-06-06 10:21:00 +02:00
Jonas Schnelli c946ebed5e fix util_tests.cpp clang warnings
was introduced with #6121
2015-06-06 10:12:12 +02:00
Wladimir J. van der Laan 7d8ffac186 Changes necessary now that zero values accepted in AmountFromValue
- Add an accept test for zero amounts, and a reject test for negative
  amounts
- Remove ugly hack in `settxfee` that is no longer necessary
- Do explicit zero checks in wallet RPC functions
- Don't add a check for zero amounts in `createrawtransaction` - this
  could be seen as a feature
2015-06-06 09:41:12 +02:00
Wladimir J. van der Laan a04bdefbeb Get rid of fPlus argument to FormatMoney
It's never used with any other value than false, the default.
2015-06-06 09:30:41 +02:00
Wladimir J. van der Laan 4b4b9a8de6 Don't go through double in AmountFromValue and ValueFromAmount
My prime gripe with JSON spirit was that monetary values still had to be
converted from and to floating point which can cause deviations (see #3759
and https://bitcoin.stackexchange.com/questions/22716/bitcoind-sendfrom-round-amount-error).

As UniValue stores internal values as strings, this is no longer
necessary. This avoids risky double-to-integer and integer-to-double
conversions completely, and results in more elegant code to boot.
2015-06-06 09:30:41 +02:00
Peter Todd 076badb60f
Add getblockheader RPC call
Alternative to getblock that works even when the block itself has been
pruned, returning all available information.
2015-06-05 17:07:58 -02:30
Wladimir J. van der Laan 12cdbabc26
Merge pull request #6152
08d9373 Remove unused code from wallet and validation interface (Michael Ford)
2015-06-05 21:24:15 +02:00
Wladimir J. van der Laan ab20ae8079
Merge pull request #6238
cfc600d Bugfix: Correct links for Xcode download (Luke Dashjr)
2015-06-05 08:37:36 +02:00
Wladimir J. van der Laan 3fce72eaa3
Merge pull request #6206
a9ac95c use const references where appropriate (Philip Kaufmann)
2015-06-05 07:11:44 +02:00
Wladimir J. van der Laan d38cd47fe3
Merge pull request #6234
ef5fca8 fix rpcmining/getblocktemplate univalue transition logic error (Jonas Schnelli)
2015-06-05 06:06:38 +02:00
Luke Dashjr cfc600d833 Bugfix: Correct links for Xcode download 2015-06-05 02:29:41 +00:00
Jonas Schnelli ef5fca8b80 fix rpcmining/getblocktemplate univalue transition logic error 2015-06-04 21:40:11 +02:00
Philip Kaufmann a9ac95c1bc use const references where appropriate 2015-06-04 19:34:18 +02:00
Suhas Daftuar 3e9143386a Advance pindexLastCommonBlock for blocks in chainActive
This prevents an edge case where a block downloaded and pruned
in-between successive calls to FindNextBlocksToDownload could
cause the block to be unnecessarily re-requested.
2015-06-04 13:00:26 -04:00
Wladimir J. van der Laan 466f0ea0e6
Merge pull request #6121
44c7474 univalue: add type check unit tests (Jonas Schnelli)
c023092 univalue: add strict type checking (Wladimir J. van der Laan)
7e98a3c util: Add ParseInt64 and ParseDouble functions (Wladimir J. van der Laan)
043df2b Simplify RPCclient, adapt json_parse_error test (Wladimir J. van der Laan)
519eede fix univalue json parse tests (Jonas Schnelli)
c7fbbc7 fix missing univalue types during constructing (Jonas Schnelli)
8f7e4ab fix rpc batching univalue issue (Jonas Schnelli)
9a8897f Remove JSON Spirit wrapper, remove JSON Spirit leftovers (Jonas Schnelli)
3df0411 remove JSON Spirit UniValue wrapper (Jonas Schnelli)
1f263c8 fix rpc unit test, plain numbers are not JSON compatible object (Jonas Schnelli)
e04d9c2 univalue: correct bool support (Jonas Schnelli)
0c5b2cf univalue: add support for real, fix percision and make it json_spirit compatible (Jonas Schnelli)
21c10de special threatment for null,true,false because they are non valid json (Jonas Schnelli)
6c7bee0 expicit set UniValue type to avoid empty values (Jonas Schnelli)
53b4671 extend conversion to UniValue (Jonas Schnelli)
15982a8 Convert tree to using univalue. Eliminate all json_spirit uses. (Jeff Garzik)
5e3060c UniValue: export NullUniValue global constant (Jeff Garzik)
efc7883 UniValue: prefer .size() to .count(), to harmonize w/ existing tree (Jeff Garzik)
2015-06-04 18:41:39 +02:00
Jonas Schnelli 44c7474446 univalue: add type check unit tests 2015-06-04 13:58:14 +02:00
Wladimir J. van der Laan c02309204b univalue: add strict type checking 2015-06-04 13:18:57 +02:00
Wladimir J. van der Laan 7e98a3c642 util: Add ParseInt64 and ParseDouble functions
Strict parsing functions for other numeric types.

- ParseInt64 analogous to ParseInt32, but for 64-bit values.
- ParseDouble for doubles.
- Make all three Parse* functions more strict (e.g. reject whitespace on
  the inside)

Also add tests.
2015-06-04 13:18:46 +02:00
Wladimir J. van der Laan 043df2b568 Simplify RPCclient, adapt json_parse_error test
# Conflicts:
#	src/test/rpc_tests.cpp
2015-06-04 13:18:35 +02:00
Erik Mossberg f053bd26a9 Add erkmos OpenPGP key to gitian downloader keyset 2015-06-04 12:05:53 +02:00
Jonas Schnelli 519eedeba7 fix univalue json parse tests 2015-06-04 10:35:36 +02:00
Jonas Schnelli c7fbbc7e1d fix missing univalue types during constructing 2015-06-04 09:16:21 +02:00
Jonas Schnelli 8f7e4abbe6 fix rpc batching univalue issue 2015-06-04 09:16:21 +02:00
Jonas Schnelli 9a8897f4ac Remove JSON Spirit wrapper, remove JSON Spirit leftovers
- implement find_value() function for UniValue
- replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper
- remove JSON Spirit sources
2015-06-04 09:16:21 +02:00
Jonas Schnelli 3df0411ad9 remove JSON Spirit UniValue wrapper 2015-06-04 09:16:06 +02:00
Jonas Schnelli 1f263c899e fix rpc unit test, plain numbers are not JSON compatible object
UniValues read() does only read valid json.
2015-06-04 09:16:06 +02:00
Jonas Schnelli e04d9c25cf univalue: correct bool support 2015-06-04 09:16:06 +02:00
Jonas Schnelli 0c5b2cf69a univalue: add support for real, fix percision and make it json_spirit compatible
- avoid breaking the API because of different number/percision handling
2015-06-04 09:16:06 +02:00
Jonas Schnelli 21c10de8c2 special threatment for null,true,false because they are non valid json 2015-06-04 09:16:06 +02:00
Jonas Schnelli 6c7bee0624 expicit set UniValue type to avoid empty values 2015-06-04 09:16:05 +02:00
Jonas Schnelli 53b4671a9d extend conversion to UniValue 2015-06-04 09:16:05 +02:00
Jeff Garzik 15982a8b69 Convert tree to using univalue. Eliminate all json_spirit uses. 2015-06-04 09:16:05 +02:00
Jeff Garzik 5e3060c0d1 UniValue: export NullUniValue global constant 2015-06-04 09:16:05 +02:00
Jeff Garzik efc7883772 UniValue: prefer .size() to .count(), to harmonize w/ existing tree 2015-06-04 09:16:05 +02:00
Wladimir J. van der Laan dbd8550231
Merge pull request #6220
d648236 bump version in clientversion.h (Philip Kaufmann)
2015-06-03 19:30:08 +02:00
Adam Weiss c257a8c9a6 Prune: Support noncontiguous block files
In some corner cases, it may be possible for recent blocks to end up in
the same block file as much older blocks.  Previously, the pruning code
would stop looking for files to remove upon first encountering a file
containing a block that cannot be pruned, now it will keep looking for
candidate files until the target is met and all other criteria are
satisfied.

This can result in a noncontiguous set of block files (by number) on
disk, which is fine except for during some reindex corner cases, so
make reindex preparation smarter such that we keep the data we can
actually use and throw away the rest.  This allows pruning to work
correctly while downloading any blocks needed during the reindex.
2015-06-03 13:25:33 -04:00
Wladimir J. van der Laan 9d60602444
Merge pull request #5875
aa8c827 P2P regression test for new AcceptBlock behavior (Suhas Daftuar)
9be0e68 Be stricter in processing unrequested blocks (Suhas Daftuar)
2015-06-03 16:20:58 +02:00
Wladimir J. van der Laan 9d67b10091
Merge pull request #6218
960e994 gitian: Bump cache dir for current master (Cory Fields)
be65628 gitian: bump faketime to something more recent (Cory Fields)
c3cdd7b osx: set min version to 10.7 for 0.11+ (Cory Fields)
2015-06-03 15:22:33 +02:00
Wladimir J. van der Laan c7272a50bd
Merge pull request #6226
4e157fc json: fail read_string if string contains trailing garbage (Wladimir J. van der Laan)
2015-06-03 15:13:36 +02:00
Wladimir J. van der Laan 87406aa735
Merge pull request #6214
0a32a93 OSX: use "Bitcoin Core" as Bundle Display Name (Jonas Schnelli)
a2241ea [OSX] revert renaming of Bitcoin-Qt.app (Jonas Schnelli)
2015-06-03 15:08:46 +02:00