@@ -1269,14 +1269,13 @@ var DashTx = ("object" === typeof module && exports) || {};
1269
1269
}
1270
1270
}
1271
1271
if ( output . memo ) {
1272
- let invalid = output . satoshis || output . address || output . pubKeyHash ;
1272
+ let invalid = output . address || output . pubKeyHash ;
1273
1273
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'` ) ;
1277
1275
}
1278
1276
1279
- let memoScriptHex = Tx . _createMemoScript ( output . memo , i ) ;
1277
+ let sats = output . satoshis || 0 ;
1278
+ let memoScriptHex = Tx . _createMemoScript ( output . memo , sats , i ) ;
1280
1279
let txOut = memoScriptHex . join ( _sep ) ;
1281
1280
1282
1281
tx . push ( txOut ) ;
@@ -1320,11 +1319,12 @@ var DashTx = ("object" === typeof module && exports) || {};
1320
1319
1321
1320
/**
1322
1321
* @param {String } memoHex - the memo bytes, in hex
1322
+ * @param {Uint53 } sats - typically 0, but 1.0 for proposal collateral
1323
1323
* @returns {Array<String> } - memo script hex
1324
1324
*/
1325
- Tx . _createMemoScript = function ( memoHex , i = 0 ) {
1325
+ Tx . _createMemoScript = function ( memoHex , sats , i = 0 ) {
1326
1326
let outputHex = [ ] ;
1327
- let satoshis = TxUtils . _toUint64LE ( 0 ) ;
1327
+ let satoshis = TxUtils . _toUint64LE ( sats ) ;
1328
1328
outputHex . push ( satoshis ) ;
1329
1329
1330
1330
assertHex ( memoHex , `output[${ i } ].memo` ) ;
0 commit comments