mirror of
https://github.com/OutCast3k/coinbin.git
synced 2025-01-23 02:16:18 +01:00
set correct sequence number to input when using nLocktime
This commit is contained in:
parent
529a2193d8
commit
4fa08e82ef
@ -369,11 +369,11 @@
|
|||||||
r.block = null;
|
r.block = null;
|
||||||
|
|
||||||
/* add an input to a transaction */
|
/* add an input to a transaction */
|
||||||
r.addinput = function(txid, index, script){
|
r.addinput = function(txid, index, script, sequence){
|
||||||
var o = {};
|
var o = {};
|
||||||
o.outpoint = {'hash':txid, 'index':index};
|
o.outpoint = {'hash':txid, 'index':index};
|
||||||
o.script = coinjs.script(script||[]);
|
o.script = coinjs.script(script||[]);
|
||||||
o.sequence = 4294967295;
|
o.sequence = sequence || 4294967295;
|
||||||
return this.ins.push(o);
|
return this.ins.push(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,10 +354,10 @@ $(document).ready(function() {
|
|||||||
tx.lock_time = $("#nLockTime").val()*1;
|
tx.lock_time = $("#nLockTime").val()*1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$.each($("#inputs .row"), function(i,o){
|
$.each($("#inputs .row"), function(i,o){
|
||||||
if($(".txId",o).val()!="" && $(".txIdN",o).val()!=""){
|
if($(".txId",o).val()!="" && $(".txIdN",o).val()!=""){
|
||||||
tx.addinput($(".txId",o).val(), $(".txIdN",o).val(), $(".txIdScript",o).val());
|
var sequence = (tx.lock_time==0) ? 4294967295 : 0;
|
||||||
|
tx.addinput($(".txId",o).val(), $(".txIdN",o).val(), $(".txIdScript",o).val(), sequence);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -679,6 +679,7 @@ $(document).ready(function() {
|
|||||||
try {
|
try {
|
||||||
var tx = coinjs.transaction();
|
var tx = coinjs.transaction();
|
||||||
var t = tx.deserialize(script.val());
|
var t = tx.deserialize(script.val());
|
||||||
|
|
||||||
var signed = t.sign(wifkey.val());
|
var signed = t.sign(wifkey.val());
|
||||||
$("#signedData textarea").val(signed);
|
$("#signedData textarea").val(signed);
|
||||||
$("#signedData .txSize").html(t.size());
|
$("#signedData .txSize").html(t.size());
|
||||||
|
Loading…
Reference in New Issue
Block a user