Commit graph

13 commits

Author SHA1 Message Date
Andrew Chow
18dfea0dd0 Always create 70 byte signatures with low R values
When extra entropy is not specified by the caller, CKey::Sign will
now always create a signature that has a low R value and is at most
70 bytes. The resulting signature on the stack will be 71 bytes when
the sighash byte is included.

Using low R signatures means that the resulting DER encoded signature
will never need to have additional padding to account for high R
values.
2018-08-09 18:39:56 -07:00
Daniel Kraft
57889e688d bitcoin-tx: Stricter check for valid integers
Just calling atoi to convert strings to integers does not check for
valid integers very thoroughly; in particular, it just ignores
everything starting from the first non-numeral character.  Even a string
like "foo" is fine and silently returns 0.

This meant that bitcoin-tx would not fail if such a string was passed in
various places where an integer is expected (like the locktime or an
input/output index); this means that it would, for instance, silently
accept a typo and interpret it in an unexpected way.

In this change, we use ParseInt64 for parsing strings to integers,
which actually verifies that the full string is valid as number.
New tests in the bitcoin-util-test cover the new error paths.
2018-07-07 14:25:09 +02:00
Matt Corallo
2874709a9f Expose a transaction's weight via RPC 2018-04-13 15:18:26 -04:00
practicalswift
d27327c79a Fix typos 2018-03-21 10:54:17 +01:00
MarcoFalke
faaeeb0d3e Bump univalue and fix json formatting in tests
This merge commit bumps the univalue subtree and also updates the whitespace
for some failing tests.
2017-09-29 14:35:46 +02:00
Wladimir J. van der Laan
aa624b61c9
Merge #11167: Full BIP173 (Bech32) support
8213838 [Qt] tolerate BIP173/bech32 addresses during input validation (Jonas Schnelli)
06eaca6 [RPC] Wallet: test importing of native witness scripts (NicolasDorier)
fd0041a Use BIP173 addresses in segwit.py test (Pieter Wuille)
e278f12 Support BIP173 in addwitnessaddress (Pieter Wuille)
c091b99 Implement BIP173 addresses and tests (Pieter Wuille)
bd355b8 Add regtest testing to base58_tests (Pieter Wuille)
6565c55 Convert base58_tests from type/payload to scriptPubKey comparison (Pieter Wuille)
8fd2267 Import Bech32 C++ reference code & tests (Pieter Wuille)
1e46ebd Implement {Encode,Decode}Destination without CBitcoinAddress (Pieter Wuille)

Pull request description:

  Builds on top of #11117.

  This adds support for:
  * Creating BIP173 addresses for testing (through `addwitnessaddress`, though by default it still produces P2SH versions)
  * Sending to BIP173 addresses (including non-v0 ones)
  * Analysing BIP173 addresses (through `validateaddress`)

  It includes a reformatted version of the [C++ Bech32 reference code](https://github.com/sipa/bech32/tree/master/ref/c%2B%2B) and an independent implementation of the address encoding/decoding logic (integrated with CTxDestination). All BIP173 test vectors are included.

  Not included (and intended for other PRs):
  * Full wallet support for SegWit (which would include automatically adding witness scripts to the wallet during automatic keypool topup, SegWit change outputs, ...) [see #11403]
  * Splitting base58.cpp and tests/base58_tests.cpp up into base58-specific code, and "address encoding"-code [see #11372]
  * Error locating in UI for BIP173 addresses.

Tree-SHA512: 238031185fd07f3ac873c586043970cc2db91bf7735c3c168cb33a3db39a7bda81d4891b649685bb17ef90dc63af0328e7705d8cd3e8dafd6c4d3c08fb230341
2017-09-29 10:18:45 +02:00
Pieter Wuille
c091b99379 Implement BIP173 addresses and tests 2017-09-28 16:24:30 -07:00
Matt Corallo
28d4542a0a Disallow uncompressed pubkeys in bitcoin-tx [multisig] output adds 2017-09-20 23:29:59 -04:00
Wladimir J. van der Laan
ec05c508c6 rpc: Use ValueFromAmount instead of FormatMoney in TxToUniv
With this, the amounts returned in `decoderawtransaction` will be
padded to 8 digits like anywhwere else in the API.
2017-08-07 17:01:21 +02:00
jonnynewbs
0ff9320bf5 refactor TxToJSON() and ScriptPubKeyToJSON() 2017-04-28 10:01:56 -04:00
John Newbery
19ecd1e2e1 Add tests for bitcoin-tx input checking 2017-03-30 16:37:53 -04:00
John Newbery
21704f6334 Check stderr when testing bitcoin-tx 2017-03-30 16:37:53 -04:00
John Newbery
63d66ba20a Move src/test/bitcoin-util-test.py to test/util/bitcoin-util-test.py 2017-03-20 10:40:31 -04:00