Skip to content

Commit 59c5816

Browse files
committed
fix: allow user-defined sequence and null sighashtype
1 parent cdb5550 commit 59c5816

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

dashtx.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ var DashTx = ("object" === typeof module && exports) || {};
12711271
tx.push(rawScript);
12721272
}
12731273

1274-
let sequence = "ffffffff";
1274+
let sequence = input.sequence ?? "ffffffff";
12751275
tx.push(sequence);
12761276

12771277
return tx;
@@ -2086,6 +2086,7 @@ if ("object" === typeof module) {
20862086
* @prop {String} [script] - the previous lock script (default: derived from public key as p2pkh)
20872087
* @prop {String} publicKey - hex-encoded public key (typically starts with a 0x02 or 0x03 prefix)
20882088
* @prop {String} [pubKeyHash] - the 20-byte pubKeyHash (address without magic byte or checksum)
2089+
* @prop {String} [sequence] - the 4-byte sequence (typically ffffffff)
20892090
* @prop {Uint32} sigHashType - typically 0x81 (SIGHASH_ALL|SIGHASH_ANYONECANPAY)
20902091
*/
20912092

@@ -2100,6 +2101,7 @@ if ("object" === typeof module) {
21002101
* @prop {String} [script] - the previous lock script (default: derived from public key as p2pkh)
21012102
* @prop {String} [publicKey] - hex-encoded public key (typically starts with a 0x02 or 0x03 prefix)
21022103
* @prop {String} [pubKeyHash] - the 20-byte pubKeyHash (address without magic byte or checksum)
2104+
* @prop {String} [sequence] - the 4-byte sequence (typically ffffffff)
21032105
* @prop {Uint32} sigHashType - typically 0x81 (SIGHASH_ALL|SIGHASH_ANYONECANPAY)
21042106
*/
21052107

@@ -2110,6 +2112,7 @@ if ("object" === typeof module) {
21102112
* @prop {String} [txId] - deprecated
21112113
* @prop {String} txid - hex (not pre-reversed)
21122114
* @prop {Uint32} outputIndex - index in previous tx's output (vout index)
2115+
* @prop {String} [sequence] - the 4-byte sequence (typically ffffffff)
21132116
*/
21142117

21152118
/**
@@ -2134,7 +2137,7 @@ if ("object" === typeof module) {
21342137
*/
21352138

21362139
/**
2137-
* @typedef {Pick<TxInput, "txId"|"txid"|"outputIndex"|"signature"|"publicKey"|"sigHashType">} TxInputSigned
2140+
* @typedef {Pick<TxInput, "txId"|"txid"|"outputIndex"|"signature"|"publicKey"|"sequence"|"sigHashType">} TxInputSigned
21382141
*/
21392142

21402143
/**
@@ -2355,7 +2358,7 @@ if ("object" === typeof module) {
23552358
* @param {Uint32} [txInfo.locktime]
23562359
* @param {Hex?} [txInfo.extraPayload] - extra payload
23572360
* @param {Boolean} [txInfo._debug] - bespoke debug output
2358-
* @param {Uint32} [sigHashType]
2361+
* @param {Uint32?} [sigHashType]
23592362
*/
23602363

23612364
/**
@@ -2368,7 +2371,7 @@ if ("object" === typeof module) {
23682371
* @param {Array<TxOutput>} txInfo.outputs
23692372
* @param {Hex?} [txInfo.extraPayload] - extra payload
23702373
* @param {Boolean} [txInfo._debug] - bespoke debug output
2371-
* @param {Uint32} sigHashType
2374+
* @param {Uint32?} sigHashType
23722375
*/
23732376

23742377
/**

0 commit comments

Comments
 (0)