Skip to content

Commit 3964d8c

Browse files
committed
fix: allow true OP_RETURN "burn" transactions for gobject / prosposals
1 parent 5892932 commit 3964d8c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

dashtx.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,14 +1269,13 @@ var DashTx = ("object" === typeof module && exports) || {};
12691269
}
12701270
}
12711271
if (output.memo) {
1272-
let invalid = output.satoshis || output.address || output.pubKeyHash;
1272+
let invalid = output.address || output.pubKeyHash;
12731273
if (invalid) {
1274-
throw new Error(
1275-
`memo outputs must not have 'satoshis', 'address', or 'pubKeyHash'`,
1276-
);
1274+
throw new Error(`memo outputs must not have 'address' or 'pubKeyHash'`);
12771275
}
12781276

1279-
let memoScriptHex = Tx._createMemoScript(output.memo, i);
1277+
let sats = output.satoshis || 0;
1278+
let memoScriptHex = Tx._createMemoScript(output.memo, sats, i);
12801279
let txOut = memoScriptHex.join(_sep);
12811280

12821281
tx.push(txOut);
@@ -1320,11 +1319,12 @@ var DashTx = ("object" === typeof module && exports) || {};
13201319

13211320
/**
13221321
* @param {String} memoHex - the memo bytes, in hex
1322+
* @param {Uint53} sats - typically 0, but 1.0 for proposal collateral
13231323
* @returns {Array<String>} - memo script hex
13241324
*/
1325-
Tx._createMemoScript = function (memoHex, i = 0) {
1325+
Tx._createMemoScript = function (memoHex, sats, i = 0) {
13261326
let outputHex = [];
1327-
let satoshis = TxUtils._toUint64LE(0);
1327+
let satoshis = TxUtils._toUint64LE(sats);
13281328
outputHex.push(satoshis);
13291329

13301330
assertHex(memoHex, `output[${i}].memo`);

0 commit comments

Comments
 (0)