Commit Graph

180 Commits

Author SHA1 Message Date
Ariel
7245f32835 update SignatureHash according to Overwinter spec
with help from str4d
2018-02-20 04:22:21 +00:00
Jack Grigg
d55e5e778b Cleanup: Wrap function arguments 2018-02-20 04:22:21 +00:00
Jack Grigg
be12669982 Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter
We do not need to be able to calculate multiple SignatureHash versions for a
single transaction format; instead, we use the transaction format to determine
the SigVersion.

The consensus branch ID *does* need to be passed in from the outside, as only
the caller knows the context in which the SignatureHash is being calculated
(ie. mempool acceptance vs. block validation).

JoinSplit signature verification has been moved into ContextualCheckTransaction,
where the consensus branch ID can be obtained.

The argument to the sign command for zcash-tx has been modified to take a height
in addition to the optional sigtype flags.
2018-02-20 04:22:20 +00:00
Pieter Wuille
6514771a44 Rename to PrecomputedTransactionData 2018-02-20 04:22:20 +00:00
Pieter Wuille
f762d44973 Precompute sighashes
Original version by Nicolas Dorier. Precomputing version by Pieter Wuille.

Edited for Zcash by Ariel Gabizon and Jack Grigg
2018-02-20 04:22:20 +00:00
Jack Grigg
e005ff83ab Remove P2WPKH and P2WSH from signing logic
Separated from the previous commit for ease of review.
2018-02-20 04:22:19 +00:00
Pieter Wuille
157a5d0d9c BIP143: Signing logic 2018-02-20 04:22:19 +00:00
Pieter Wuille
c86a1cb86e BIP143: Verification logic
Includes simplifications by Eric Lombrozo.

Edited for Zcash merge by Ariel Gabizon.
2018-02-20 04:22:19 +00:00
Pieter Wuille
2d42e1a993 Refactor script validation to observe amounts
This is a preparation for BIP143 support.

Edited for Zcash merge by Ariel Gabizon.
2018-02-20 04:22:19 +00:00
Scott Sadler
f5cf215f71 extra tests for failure modes and remove CRYPTOCONDITION_OVERSIZE error state 2018-02-19 18:24:12 -03:00
Scott Sadler
656fa68d13 guard cryptoconditions 2018-02-18 20:40:24 -03:00
Scott Sadler
28b946127b make IsPayToCryptoCondition neat 2018-02-18 19:35:48 -03:00
Scott Sadler
5b383ba7f4 enable cryptoconditions spending 2018-02-18 18:49:04 -03:00
Scott Sadler
a99ca25a5a cryptocondition transaction is standard too 2018-02-17 02:03:34 -03:00
Scott Sadler
6e821110fd auxiliary cryptoconditions 2018-02-06 18:37:08 -03:00
Scott Sadler
07f83521f7 basic integration of cryptoconditions 2017-10-19 14:08:32 -07:00
Daira Hopwood
de609b8c54 Strict DER signatures are always enforced; remove the flag and code that used it.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-06-17 17:19:08 +01:00
Jack Grigg
c032f1b687 Add comments 2017-06-17 12:09:44 +12:00
Pieter Wuille
3d02d0f63a Switch to libsecp256k1-based validation for ECDSA 2017-06-06 17:52:25 +12:00
jl777
945f015d80 Initial merge 2017-03-30 04:35:16 +03:00
Pieter Wuille
18e804a925 Add DummySignatureCreator which just creates zeroed sigs 2017-03-02 13:23:03 -08:00
jl777
7a82f2fc73 test 2016-11-21 18:28:30 -03:00
jl777
ce71f7729c test 2016-11-21 17:48:52 -03:00
jl777
cc0f93da2e test 2016-11-21 17:47:23 -03:00
jl777
a2829a0c45 test 2016-11-21 17:38:24 -03:00
jl777
97b426a8cd test 2016-11-21 17:36:49 -03:00
jl777
30853e4ab9 Merge remote-tracking branch 'zcash/master' into dPoW 2016-10-28 13:50:21 -03:00
jl777
4aa2c64e7b test 2016-10-25 10:51:04 -03:00
jl777
e30a267f36 test 2016-10-25 10:42:43 -03:00
jl777
cf9538e02b test 2016-10-25 10:33:49 -03:00
jl777
b62d7030ef prepare for assetchains 2016-10-25 10:11:37 -03:00
jl777
beafd76b02 test 2016-10-25 08:23:55 -03:00
zkbot
7ccbcca62c Auto merge of #1591 - bitcartel:upstream_7933_fix_out_of_memory_deserializing_utxo, r=daira
Upstream: fix out of memory problem when deserializing utxo

bitcoin/bitcoin#7933
2016-10-21 23:32:51 -04:00
Pieter Wuille
6fc5764eda Treat overly long scriptPubKeys as unspendable 2016-10-20 22:59:50 -07:00
Pieter Wuille
4c6ea562bd Introduce constant for maximum CScript length 2016-10-20 22:59:50 -07:00
jl777
5b760d3f80 test 2016-10-19 12:30:43 -03:00
Jack Grigg
08d6b02d5e Rename libbitcoinconsensus to libzcashconsensus
Closes #1563
2016-10-18 16:45:37 -05:00
Jack Grigg
bab187e963 Disable OP_CODESEPARATOR 2016-10-01 01:16:51 +13:00
Daira Hopwood
05e2db116d Remove FindAndDelete. refs #1386
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-09-27 00:48:30 +01:00
Taylor Hornby
67f0243533 Remove in-band error signalling from SignatureHash, fixing the SIGHASH_SINGLE bug. 2016-07-19 16:36:35 -06:00
Sean Bowe
8675d94b63 Rename vpour to vjoinsplit. 2016-07-18 10:06:18 -06:00
Sean Bowe
1e99cbab04 Use joinsplit_sig_t in more places. 2016-05-30 19:33:28 -06:00
Sean Bowe
320f2cc7e0 Switch to Ed25519 for cryptographic binding of joinsplits to transactions. 2016-05-30 11:05:55 -06:00
Taylor Hornby
b48122b57b Fix tests for JoinSplit signatures 2016-05-30 11:05:43 -06:00
Taylor Hornby
a138f81404 Implement signature verification in CheckTransaction 2016-05-30 11:05:43 -06:00
Taylor Hornby
6aae9d1a55 Sign JoinSplit transactions 2016-05-30 11:05:31 -06:00
Sean Bowe
5884044ba9 Introduce vpour to CTransaction.
Transactions of version 2 and above contain a `vpour` field which is a vector of `CPourTx`
objects that embody our protocol. We introduce serialization primitives for boost::array
(we intend for changing the amount of inputs and outputs in the circuit to be simple).

SIGHASH_* operations hash this field like any other for now.
2016-01-19 14:35:59 -07:00
Peter Todd
5e82e1c8f5 Add CHECKLOCKTIMEVERIFY (BIP65) soft-fork logic
Based on the earlier BIP66 soft-fork logic implemented by Pieter
Wuille's 5a47811da5

Rebased-From: 287f54fc90c29301faede8d4ac2ea24a91441917
2015-10-08 17:48:51 +02:00
Peter Todd
6ea5ca4b4e Enable CHECKLOCKTIMEVERIFY as a standard script verify flag
Transactions that fail CLTV verification will be rejected from the
mempool, making it easy to test the feature. However blocks containing
"invalid" CLTV-using transactions will still be accepted; this is *not*
the soft-fork required to actually enable CLTV for production use.

Rebased-From: ffd75adce01a78b3461b3ff05bcc2b530a9ce994
2015-10-08 17:48:10 +02:00
Peter Todd
4fa7a048d1 Replace NOP2 with CHECKLOCKTIMEVERIFY (BIP65)
<nLockTime> CHECKLOCKTIMEVERIFY -> <nLockTime>

Fails if tx.nLockTime < nLockTime, allowing the funds in a txout to be
locked until some block height or block time in the future is reached.

Only the logic and unittests are implemented; this commit does not have
any actual soft-fork logic in it.

Thanks to Pieter Wuille for rebase.

Credit goes to Gregory Maxwell for the suggestion of comparing the
argument against the transaction nLockTime rather than the current
time/blockheight directly.

Rebased-From: bc60b2b4b401f0adff5b8b9678903ff8feb5867b
2015-10-08 17:46:55 +02:00