fixed miner fee issue in sendTransaction
This commit is contained in:
parent
3c11bedac2
commit
52bffd0fc3
@ -14614,7 +14614,7 @@
|
||||
var obj = utxo_list[key];
|
||||
sum += obj.amount;
|
||||
|
||||
if (btc_eq_receiving_amount <= sum - miners_fee) {
|
||||
if (btc_eq_receiving_amount <= sum) {
|
||||
trx.addinput(obj.txid, obj.vout, obj.scriptPubKey);
|
||||
break;
|
||||
} else {
|
||||
@ -14623,12 +14623,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
btc_eq_receiving_amount = btc_eq_receiving_amount - miners_fee;
|
||||
trx.addoutput(receiver_address, btc_eq_receiving_amount);
|
||||
|
||||
let change_amount = 0;
|
||||
if (sum - btc_eq_receiving_amount - miners_fee>0) {
|
||||
if (sum - btc_eq_receiving_amount - miners_fee > 0) {
|
||||
change_amount = sum - btc_eq_receiving_amount - miners_fee;
|
||||
}
|
||||
|
||||
trx.addoutput(receiver_address, btc_eq_receiving_amount);
|
||||
if (change_amount>0) {
|
||||
trx.addoutput(change_adress, change_amount);
|
||||
}
|
||||
@ -14644,6 +14646,7 @@
|
||||
let signedTxHash = trx.sign(utxo_addr_wif, 1); //SIGHASH_ALL DEFAULT 1
|
||||
showMessage(`Signed Transaction Hash: ${signedTxHash}`);
|
||||
console.log(signedTxHash);
|
||||
return;
|
||||
|
||||
var http = new XMLHttpRequest();
|
||||
var tx_send_url = `${blockchain_explorer}/api/tx/send`;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user