Daniel Cousens
baec325e6f
base58: use signum over compareTo
11 years ago
Daniel Cousens
5f88cb8931
ECKey: use signum over compareTo
11 years ago
Daniel Cousens
3bce535e36
Wallet: use assert for consistency
11 years ago
Daniel Cousens
b9bdf21cbe
bufferutils: use verifuint for 64 bit integers
Taken from browserify-buffer.
Also adds a few more tests to assert this is working correctly from both
read and write perspectives.
The assertion in for writePushDataInt in the 32 bit case was
unnecessary as that is handled by buffer.writeUInt32LE anyway.
11 years ago
Daniel Cousens
80da2ed2d5
HDWallet: add fromBase58 exception checks
11 years ago
Daniel Cousens
cde285ccfc
Wallet: enforce operator new
11 years ago
Daniel Cousens
4952c5f4e7
HD/Wallet: use network objects, not strings
11 years ago
Daniel Cousens
2df790e2ab
Wallet: remove use of hashLittleEndian
11 years ago
Daniel Cousens
4afdbc9f68
Wallet: use dustThreshold directly
The definition of a dust amount is pretty clear, and I feel it is less
readable when represented as isDust(amount) or !isDust(amount), by
comparison to amount <= dustThreshold or amount > dustThreshold.
Also means I don't have to stray my eyes to understand the
implemention by looking up isDust does.
11 years ago
Daniel Cousens
bd3690bdc0
Wallet: remove async interface
11 years ago
Daniel Cousens
50e9a09a8c
Wallet: cleanup createTx control flow
Unknowingly this also revealed a subtle bug in the previous
implementation which allowed the creation of transactions even
when no UTXOs existed.
11 years ago
Daniel Cousens
b10e96cbff
ecdsa: serializeSig should return a Buffer
11 years ago
Daniel Cousens
7e9b5d8584
bufferutils: return opcode for use
11 years ago
Daniel Cousens
6f3d829be0
all: Expected T, got PARAM
11 years ago
Daniel Cousens
2f44628604
Transaction: refactor hashForSignature
Adds asserts to ensure only valid hashes are created (until the
implementation is complete).
Also uses `Script.without` to remove OP_CODESEPARATOR from the Scripts
as required by the protocol.
11 years ago
Daniel Cousens
7d94d1b068
Script: add fromChunks and without
11 years ago
Daniel Cousens
d18f2dba00
bufferutils: add PUSHDATA implementation
11 years ago
Daniel Cousens
54950c9abb
Transaction: fix SIGHASH_* constant values
11 years ago
Daniel Cousens
db814439a3
Transaction: extract DEFAULT_SEQUENCE constant
Also fixes the bug when the sequence number is 0 and
`TransactionIn.defaultSequence` is used; resulting in an undefined
sequence number as it is undefined.
11 years ago
Daniel Cousens
7494a146a6
ECKey: fix exception tests
These weren't broken as such, but they weren't distinctly checking that
the right exception was thrown either.
11 years ago
Daniel Cousens
6cfa729dae
ecdsa: fix missing exceptions
11 years ago
Daniel Cousens
2fc69b0834
address/base58check: fix missing exceptions/tests
All the `invalid2` tests have been removed as they were not invalid
base58check. They were actually valid in some cases.
They will be re-integrated in more specific bitcoin core tests in
relation to Address/ECKey respectively.
11 years ago
Daniel Cousens
47ae862ae9
base58: fix missing exceptions
11 years ago
John Russell
343289229e
ensures that pubKey length is greater than m
ensure that pubKey length is greater than m
use Array.isArray over instanceof
error message
11 years ago
Daniel Cousens
8514bbfabd
Address: remove Address.Error
By removing Address.Error, we remove a code smell.
This part of the code base was also not under any form of test.
Test data and tests have therefore been added verifying its behaviour in
both Wallet and Address tests.
11 years ago
Kyle Drake
33e5883be1
sec: remove untested alt curves not used by bitcoin
11 years ago
Kyle Drake
600209b1a6
hdwallet: remove fromHex, add better tests for edge cases
11 years ago
Daniel Cousens
08951be66f
Script: add createPubKeyScriptPubKey
11 years ago
Kyle Drake
f545ed1279
remove crypto hash transition code
11 years ago
Daniel Cousens
58fd12e66d
ecdsa: always use signature object
11 years ago
Daniel Cousens
bd1a08bfa1
ecdsa: use signum() over compareTo
11 years ago
Kyle Drake
bc062fbdce
cleanup some unused ec.js code
11 years ago
Daniel Cousens
aca565239a
ECKey: remove unnecessary slice
11 years ago
Daniel Cousens
cd326921bc
bigi: upgrade to 1.1.0
11 years ago
Daniel Cousens
1087ac07de
sec: fix formatting
11 years ago
Daniel Cousens
b8858c0bc9
sec: use BigInteger.fromHex directly
11 years ago
Daniel Cousens
da48c988f6
sec: use a hashtable for lookup
11 years ago
Daniel Cousens
087ca551f5
ecdsa: fix indentation
11 years ago
Daniel Cousens
d05d661aea
ecdsa: use standard declarative notation for functions
11 years ago
Daniel Cousens
bcfd62fdb5
ecdsa: remove implicit ecparams
11 years ago
Daniel Cousens
2dec1375a1
ecdsa: use (r, s) values directly
11 years ago
Daniel Cousens
8d7408202f
ecdsa: consistent parameter ordering
11 years ago
Daniel Cousens
abe65b8d4a
ecdsa: use shamirs trick
11 years ago
Daniel Cousens
a17a5b23d9
ec: fix point decoding for other curves
11 years ago
Daniel Cousens
5ec9504ed6
ecdsa: opt for shiftRight, pow and square
In the given situations, these offer better readability, or in the case
of shiftRight, a substantial performance increase.
11 years ago
Daniel Cousens
7d89ff427c
ecdsa: comment cleanup
11 years ago
Daniel Cousens
0865f09d20
ec/dsa: extract P_OVER_FOUR as a curve specific constant
This actually resolves a possible bug if multiple ecparams were used
(aka different values for P_OVER_FOUR, but only the cached was used).
11 years ago
Daniel Cousens
1e54c521d5
ec: extract BigInteger constants
11 years ago
Daniel Cousens
d9ce4bee6b
ec: use signum() not equals(BigInteger.ZERO)
11 years ago
Daniel Cousens
d14b08efd1
ec/dsa: recovery param now used consistently
Also added an assertion rather than massaging the input.
11 years ago