bug fix: new line in floData cause error

since newline char is not supported in floData, new line (\n) is replaced with space.
This commit is contained in:
sairajzero 2020-05-22 18:50:29 +05:30
parent aff5b927e9
commit 5e1e8a624f

View File

@ -7400,7 +7400,7 @@ Bitcoin.Util = {
var change = utxoAmt - sendAmt - fee; var change = utxoAmt - sendAmt - fee;
if (change > 0) if (change > 0)
trx.addoutput(senderAddr, change); trx.addoutput(senderAddr, change);
trx.addflodata(floData); trx.addflodata(floData.replace(/\n/g,' '));
var signedTxHash = trx.sign(privKey, 1); var signedTxHash = trx.sign(privKey, 1);
this.broadcastTx(signedTxHash) this.broadcastTx(signedTxHash)
.then(txid => resolve(txid)) .then(txid => resolve(txid))
@ -7431,7 +7431,7 @@ Bitcoin.Util = {
} }
} }
trx.addoutput(floID, utxoAmt - fee); trx.addoutput(floID, utxoAmt - fee);
trx.addflodata(floData); trx.addflodata(floData.replace(/\n/g,' '));
var signedTxHash = trx.sign(privKey, 1); var signedTxHash = trx.sign(privKey, 1);
this.broadcastTx(signedTxHash) this.broadcastTx(signedTxHash)
.then(txid => resolve(txid)) .then(txid => resolve(txid))
@ -7616,7 +7616,7 @@ Bitcoin.Util = {
} }
for (floID in receivers) for (floID in receivers)
trx.addoutput(floID, receivers[floID]); trx.addoutput(floID, receivers[floID]);
trx.addflodata(floData); trx.addflodata(floData.replace(/\n/g,' '));
for (let i = 0; i < wifSeq.length; i++) for (let i = 0; i < wifSeq.length; i++)
trx.signinput(i, wifSeq[i], 1); trx.signinput(i, wifSeq[i], 1);
var signedTxHash = trx.serialize(); var signedTxHash = trx.serialize();