Commit graph

1203 commits

Author SHA1 Message Date
Wesley Smith
c3c98709e2 fixes adding version field to transaction instance 2018-05-06 22:40:27 -07:00
Daniel Cousens
024c541d7e
Merge branch 'master' into __tx 2018-04-30 10:43:44 +10:00
Daniel Cousens
6b3c41a06c
Merge pull request #1035 from bitcoinjs/buremove
Remove bufferutils
2018-04-30 10:41:27 +10:00
Daniel Cousens
41885bfab2 nulldata: change data to array 2018-04-14 01:59:56 +10:00
Daniel Cousens
5af87c0c49 privatise internals for TxBuilder 2018-04-14 01:31:02 +10:00
Daniel Cousens
3bfdacafa2 change TransactionBuilder to default to version 2 2018-04-14 01:18:31 +10:00
Daniel Cousens
549b36bf1a rm deprecated bufferutils 2018-04-14 01:15:22 +10:00
Dabura667
413495b101
Merge pull request #987 from bitcoinjs/tests
Reject any uncompressed keys in P2WSH and P2WPKH (as per BIP143)
2018-01-17 23:00:55 +09:00
Daniel Cousens
00bbab1a93 txb: fix redeemScript/witnessScript is undefined when throwing
unsupported
2018-01-17 14:57:24 +11:00
Daniel Cousens
7be698b5a1 txb: add fixes for P2SH(P2WSH(...)) and P2WSH(...) in BIP143 compliance 2018-01-17 14:49:19 +11:00
Daniel Cousens
39a681d2d3 tests: add failing test for #981 2018-01-17 14:48:56 +11:00
Daniel Cousens
098188dd3a tests: add independent error message for missing witnessScript 2018-01-17 14:25:06 +11:00
Dabura667
64d9f72f77
Update comment
fixes #979
2018-01-10 23:54:38 +09:00
Daniel Cousens
8d688c39a6 enforce decodeStack receives a stack array 2017-11-30 15:34:30 +11:00
Melvillian
f4caa54d9e
increase max feerate sanity check from 1000 to 2500 2017-11-22 10:48:20 -08:00
Daniel Cousens
a868d27407 TxBuilder: add support for RSBuffer type keyPairs and .publicKey 2017-10-19 13:41:57 +11:00
Daniel Cousens
b94da10e6c ECSignature: add toRSBuffer/fromRSBuffer 2017-10-19 13:41:35 +11:00
Daniel Cousens
e0b227e4ef s/checkP2shInput/checkP2SHInput 2017-10-19 10:52:21 +11:00
Daniel Cousens
1157856ab0 Merge pull request #911 from bitcoinjs/segwittests
Add tests for scripts.witness*.input and fixes
2017-09-28 00:03:11 +10:00
Daniel Cousens
41378f9648 txbuilder: apply input.value before prepareInput 2017-09-27 10:00:36 +10:00
Daniel Cousens
8c217a7ba7 witnessScriptHash: fixed implementation 2017-09-27 08:30:31 +10:00
Daniel Cousens
f4a83f8aed address/txbuilder: require templates to prevent undefined exports 2017-09-27 07:08:19 +10:00
Daniel Cousens
b6a6b0a50a Merge pull request #908 from bitcoinjs/txbfix
TxBuilder: fix canSign returning true for missing witness value
2017-09-26 20:02:55 +10:00
Daniel Cousens
eb6eac67b0 txbuilder: fix canSign returning true for missing witness value 2017-09-26 18:49:14 +10:00
Daniel Cousens
bae91395ef rm bscript circular dependencies 2017-09-26 14:25:30 +10:00
Daniel Cousens
8f01e4273c match scriptHash types 1 for 1, ignore classify order 2017-09-22 12:15:10 +10:00
Thomas Kerin
da49e389c4 multisig.input.encodestack - replace OP_0 (permitted by partialSignature) with EMPTY_BUFFER 2017-09-15 19:08:55 +10:00
Thomas Kerin
105a82762c buildstack - don't return op_0 2017-09-15 19:08:55 +10:00
junderw
6e5742d86d Fix txb.__overMaximumFees for segwit 2017-09-15 12:31:35 +10:00
Daniel Cousens
9503e64bde TransactionBuilder: collect witnessValue as input.value, and match it 2017-09-06 20:59:10 +10:00
junderw
1495384862 Add witness is true to signing 2017-09-06 20:46:20 +10:00
Daniel Cousens
e7c59c4b8b script: use asMinimalOP for ASM/decompile 2017-08-24 12:28:50 +10:00
Daniel Cousens
152eed57a0 templates/pubkey: only canonical pubkeys to encode 2017-08-23 17:26:06 +10:00
Daniel Cousens
3ba17a1479 TxBuilder: restrict uncompressed keyPairs for P2WPK and P2WSH 2017-08-23 17:26:06 +10:00
Daniel Cousens
3ffac6cd39 add witnessPubKeyHash compressed policy 2017-08-23 17:26:06 +10:00
Daniel Cousens
5057d8d1ba tests/txb: add P2WSH(multisig), incomplete fixture 2017-08-23 16:07:28 +10:00
Daniel Cousens
0157f18510 txbuilder: refactor branches for readability 2017-08-23 16:07:28 +10:00
Daniel Cousens
b1272a1200 add Bech32 support to toOutputScript/fromOutputScript 2017-08-21 11:17:30 +10:00
Daniel Cousens
d1052e4996 add from/toBech32 2017-08-21 11:17:30 +10:00
Thomas Kerin
798ec3512c set p2sh=true only if redeemScriptType is set 2017-08-09 15:11:05 +10:00
Thomas Kerin
0b1c3bfbd9 Should be able to deal with incomplete P2SH/P2WSH inputs when allowIncomplete is set 2017-08-09 15:11:05 +10:00
Alex Melville
eae2c57e73 remove errant argument to buildInput in __build 2017-07-21 12:12:29 +10:00
Daniel Cousens
1d6b978aff txb: do not classify blank input scripts as nonstandard 2017-07-14 14:16:52 +10:00
Karel Bilek
c96bb93841 Add weight / vsize
Weight / virtual size according to BIP141
2017-06-21 01:38:05 +10:00
Daniel Cousens
fe0ad81472 package: use safe-buffer 2017-05-23 18:39:53 +10:00
Daniel Cousens
f1ab151c31 tests: use safe-buffers throughout 2017-05-23 18:39:53 +10:00
Daniel Cousens
aeb0312d63 use safe-buffers throughout impl 2017-05-23 18:39:53 +10:00
Daniel Cousens
78b2d34af6 networks: changed P2SH to 0x32 2017-05-10 10:25:29 +10:00
Loshan T
2228d285a4 Update Litecoin P2SH 2017-05-10 10:25:29 +10:00
Daniel Cousens
ab1fc4c9a4 reduce bufferutils usage 2017-04-19 17:42:05 +10:00
Daniel Cousens
cdb518686f txbuilder: remove unused y var 2017-04-18 14:34:54 +10:00
Daniel Cousens
6c220c4b58 templates: add missing allowComplete pass through 2017-04-18 14:34:54 +10:00
Daniel Cousens
91ff39d95a ecpair/hdnode: fix network variable shadowing 2017-04-18 14:34:54 +10:00
Daniel Cousens
f3d0dddc5a block: add byteLength 2017-04-18 13:46:30 +10:00
Daniel Cousens
b552c63fb0 nulldata: no blank lines at EOF 2017-03-29 21:02:59 +11:00
Daniel Cousens
846da39346 script: adhere to latest standard precedence rules 2017-03-29 21:02:59 +11:00
Daniel Cousens
1ce81a92cc block: rm i temporary var 2017-03-29 09:36:07 +11:00
Daniel Cousens
35bbe11055 block: change exponent offset to avoid subtraction 2017-03-29 09:36:07 +11:00
Daniel Cousens
29316a2fbc block: use writeUInt32BE for target calculation 2017-03-29 09:36:07 +11:00
Thomas Kerin
4b4f32ffac buildStack: allow empty stack if allowIncomplete is set 2017-02-07 12:40:49 +11:00
Thomas Kerin
793939dc8c scriptHash return true for chunks.length=1 so long as its witness 2017-02-07 12:40:49 +11:00
Thomas Kerin
c2dfc03869 Add test vectors, and transaction_builder input stores signScript 2017-02-07 12:40:49 +11:00
Thomas Kerin
e4db4a07b0 Make sure case with only one value in scriptSig as P2SH ONLY applies if the script is P2WPKH or P2WSH 2017-02-07 12:40:49 +11:00
Thomas Kerin
fff9319fa4 scriptHash.input.check - should tolerate 1 field in scriptSig if it's P2WSH or P2WPKH 2017-02-07 12:40:49 +11:00
Thomas Kerin
c5541c8f96 transaction_builder: expandInput - check p2sh early, can avoid redundant assignments 2017-02-07 12:40:49 +11:00
Thomas Kerin
a32cc5b3be remove debugging code 2017-02-07 12:40:49 +11:00
Thomas Kerin
52745d1d0c fromTransaction.build tests pass - look for segwit transaction vectors 2017-02-07 12:40:49 +11:00
Thomas Kerin
f8a94f3496 messy commits, clean later, just one test left 2017-02-07 12:40:49 +11:00
Thomas Kerin
a213435135 Commit work to date 2017-02-07 12:40:49 +11:00
Thomas Kerin
b24dc44770 P2WSH working, now for tests 2017-02-07 12:40:49 +11:00
Thomas Kerin
3ad31571b6 P2WSH initial commit, tests pass with new logic 2017-02-07 12:40:49 +11:00
Thomas Kerin
b6ae10b2f1 buildStack, and make tests pass 2017-02-07 12:40:49 +11:00
Daniel Cousens
a793166eb8 wip 2017-02-07 12:40:49 +11:00
Daniel Cousens
80762543e7 templates: add encode/decode* stack functions 2017-02-07 12:40:49 +11:00
Daniel Cousens
33c3ed4e03 templates: avoid hex conversions internally 2017-01-03 23:55:03 +11:00
Thomas Kerin
9d9d101b5f Script templates: add witness commitment template 2017-01-03 22:37:11 +11:00
Daniel Cousens
3635a9f078 s/scriptPubKey/outputScript 2016-12-23 13:55:15 +11:00
Daniel Cousens
14f9218389 package: bump bs58check, drop node 0.12 2016-12-22 08:21:18 +11:00
Daniel Cousens
33c72e49c4 package/*: use bitcoin-ops, pushdata-bitcoin packages 2016-12-18 10:38:43 +00:00
Daniel Cousens
a86e905611 script: add fromASM failing test case and fix 2016-12-17 14:30:37 +11:00
Thomas Kerin
8552867695 bscript.compie - minimal encoding of -1 stack element 2016-12-17 14:17:27 +11:00
Daniel Cousens
2bb021ab64 rm *PushOnly, add isPushOnly and toStack 2016-12-17 14:17:27 +11:00
Daniel Cousens
d853806d0d templates: fix bad comment 2016-12-15 11:45:59 +11:00
Daniel Cousens
5824a84fd5 transaction_builder: keep a mapping from prevTxOut to vin 2016-12-15 11:45:59 +11:00
Daniel Cousens
c81f561f3e transaction: no i variable shadow 2016-12-14 09:05:58 +11:00
Thomas Kerin
bec7f690ce Rename __hasWitnesses -> hasWitnesses, and add tests 2016-12-08 09:11:13 +11:00
Daniel Cousens
7227017b40 scripts: multisig naming consistency 2016-11-21 11:04:01 +11:00
Daniel Cousens
433d9f1b18 templates: push only for scriptHash inputs, fixes #705 2016-11-15 10:06:18 +11:00
Daniel Cousens
b1daff1108 script: use isPushOnly internally 2016-11-15 10:06:18 +11:00
Daniel Cousens
8df1b45699 script: use typeforce to enforce push-only chunks 2016-11-15 10:06:18 +11:00
Thomas Kerin
0696ca95b6 Script: add {compile,decompile}PushOnly 2016-11-14 15:13:12 +11:00
Daniel Cousens
72fbd00762 Transaction: Witness serialization support default only for some functions (fixed) 2016-11-14 15:05:30 +11:00
Daniel Cousens
29422b584d Transaction: fix setWitness to accept array of Buffers (fixed) 2016-11-14 15:05:30 +11:00
Thomas Kerin
a9f124423f Test that parsing a transaction with superfluous witness data leads to an error 2016-11-14 11:22:22 +11:00
Daniel Cousens
905f5ba1a5 transaction: hashForWitnessV0 s/amount/value 2016-11-14 11:22:22 +11:00
Daniel Cousens
768f7e314c Transaction: initialize to ZERO earlier 2016-11-14 11:22:22 +11:00
Thomas Kerin
3f731d090a Test that parsing a transaction with superfluous witness data leads to an error 2016-11-14 11:22:22 +11:00
Daniel Cousens
5c2fdb6043 Transaction: add Witness serialization and hashForWitnessV0 2016-11-14 11:22:22 +11:00
Daniel Cousens
aeeee4f3ec TransactionBuilder: move ABSURD_FEE to a constructor parameter 2016-11-12 12:53:53 +01:00
Daniel Cousens
61be897429 TransactionBuilder: move ABSURD_FEERATE to static constant 2016-11-12 12:53:53 +01:00
Daniel Cousens
62389ed247 TransactionBuilder: change to ABSURD_FEERATE, not ABSURD_FEE 2016-11-12 12:53:53 +01:00
Daniel Cousens
e835f1fe95 TransactionBuilder: add fee safety 2016-11-12 12:53:53 +01:00
Thomas Kerin
b5e46c2931 Replace script type strings with constants 2016-11-04 12:21:26 +11:00
Daniel Cousens
9db9763221 tests: add script.*.*.decode tests 2016-11-04 07:23:02 +11:00
Daniel Cousens
0c67f5e585 templates: add toJSON for clearer error message 2016-11-04 07:23:02 +11:00
Daniel Cousens
ce5babde83 templates: fix nullData return value 2016-11-04 07:23:02 +11:00
Daniel Cousens
69d8e9ed9e move templates to templates/index.js 2016-11-04 07:23:02 +11:00
Daniel Cousens
d9fa39a2cc scripts: extract all scripts to encode/decode/check style 2016-11-04 07:23:02 +11:00
Thomas Kerin
27b48e8aa2 Add methods to decode information from output scripts 2016-11-02 10:58:45 +11:00
Thomas Kerin
53f08a7569 Script: add function for parsing multisig type scripts 2016-11-02 10:58:45 +11:00
Daniel Cousens
a956b8859f networks: drop dogecoin and dustThreshold 2016-10-20 23:40:46 -05:00
Daniel Cousens
1f66b9e3d8 HDNode: add comment about Q.compressed assumption 2016-10-18 17:45:37 +11:00
Thomas Kerin
6067220cba Remove redundant check for uncompressed public key 2016-10-18 15:59:47 +11:00
Daniel Cousens
b14abac4a1 HDNode: remove HDNode.toString for safety 2016-10-18 15:42:44 +11:00
Thomas Kerin
7b1167708a Transaction and block versions are signed integers 2016-10-13 09:29:03 +11:00
Daniel Cousens
3de754a9a2 TransactionBuilder: remove hashTypes inconsistency issues, resolves #642 2016-10-13 00:55:19 +11:00
Daniel Cousens
9dcf4d4b8b TransactionBuilder: add note why fixMultisigOrder is separate 2016-10-13 00:55:19 +11:00
Daniel Cousens
7059b177eb TransactionBuilder: re-order in order of usage 2016-10-13 00:55:19 +11:00
Daniel Cousens
6056e7913e TransactionBuilder: fixMultisigOrder only works if a redeemScript exists 2016-10-13 00:55:19 +11:00
Daniel Cousens
1ff64d207e TransactionBuilder: flatten prepareInput P2SH detection 2016-10-13 00:55:19 +11:00
Daniel Cousens
a58c959099 TransactionBuilder: localize fixMultisigOrder assumptions 2016-10-13 00:55:19 +11:00
Daniel Cousens
0e2480523a TransactionBuilder: expandInput, consistent variable names 2016-10-13 00:55:19 +11:00
Daniel Cousens
f3cc71a75f TransactionBuilder: simplify buildInput logic 2016-10-13 00:55:19 +11:00
Daniel Cousens
090b8177d1 TransactionBuilder: flatten inconsistency checks 2016-10-13 00:55:19 +11:00
Daniel Cousens
5dcf38c0c5 HDNode: clearer error for bad path type 2016-10-12 13:15:54 +11:00
Daniel Cousens
9f1ebf72a6 types: remove unused UInt2, BIP32 is capitals 2016-10-12 13:15:54 +11:00
Daniel Cousens
4ee298c414 block: add type checking 2016-10-10 11:20:20 +11:00
Daniel Cousens
dd4596a44a block: use merkle-lib instead of inline calculation 2016-10-10 11:20:20 +11:00
Daniel Cousens
3bff2c63af transaction: simplify toBuffer offset management 2016-10-10 07:56:18 +11:00
Daniel Cousens
f7b2fdfe60 TransactionBuilder: avoid input mutation until after exception possibility 2016-10-09 22:04:32 +11:00
Daniel Cousens
17377381c4 TransactionBuilder: if prevOutScript is defined, but not signable, try 1 last time 2016-10-09 22:04:32 +11:00
Daniel Cousens
45b0e35264 transaction/types: use Satoshi over UInt53 2016-10-07 14:25:44 +11:00
Daniel Cousens
ecc6d45a7e types: add Satoshi 2016-10-07 14:25:44 +11:00
Daniel Cousens
29a865788d use varuint-bitcoin 2016-10-07 10:55:34 +11:00
Daniel Cousens
7cdabef954 ecdsa: remove unused functions 2016-10-06 21:40:42 +11:00
Daniel Cousens
87cb018466 rm message module 2016-10-06 21:40:42 +11:00
Daniel Cousens
fd40232147 package: remove buffer-compare/buffer-equals 2016-10-06 21:31:10 +11:00
Daniel Cousens
0e08a9b0ce Revert "HDNode: remove unnecessary this context" 2016-10-06 21:16:56 +11:00
Daniel Cousens
7a066b68ed HDNode: remove unnecessary this context 2016-10-06 14:08:27 +11:00
Daniel Cousens
b91cfcf196 package: update to typeforce 1.8.7 2016-10-06 12:34:11 +11:00
Daniel Cousens
4ae06003c4 Merge pull request #638 from bitcoinjs/minpush
script: always compile in a minimaldata compliant way
2016-10-05 19:31:52 +11:00
Daniel Cousens
c1570f8056 script: always compile in a minimaldata compliant way 2016-09-29 13:51:17 +10:00
Daniel Cousens
1aab317dad TransactionBuilder: extract internal signature invalidation functions for individual testing 2016-09-28 16:47:58 +10:00
Daniel Cousens
ccde09fdc3 TransactionBuilder: move fixMultisigOrder back to free function 2016-09-28 15:27:14 +10:00
Daniel Cousens
402e871d40 TransactionBuilder: move sign bulk to prepareInput 2016-09-28 15:23:52 +10:00
Daniel Cousens
a1d3e33c84 address/crypto/script/types: adhere to no-use-before-define 2016-09-28 15:23:52 +10:00
Daniel Cousens
d3ccbb6277 TransactionBuilder: rename index to vout internally 2016-09-28 01:23:37 +10:00
Daniel Cousens
9e5aac8bac TransactionBuilder: fix duplicate txOut detection 2016-09-28 01:23:37 +10:00
Daniel Cousens
b3fd50ffd6 TransactionBuilder: refactor extractInput/extractFromOutput 2016-09-28 00:50:46 +10:00
Daniel Cousens
6826aa312d TransactionBuilder: less exits 2016-09-27 22:39:38 +10:00