zcash private tx support
This commit is contained in:
+1
-1
@@ -150,7 +150,7 @@ function save_tx(txid, cb) {
|
||||
lib.get_block(tx.blockhash, function(block){
|
||||
if (block) {
|
||||
lib.prepare_vin(tx, function(vin) {
|
||||
lib.prepare_vout(tx.vout, txid, vin, function(vout, nvin) {
|
||||
lib.prepare_vout(tx.vout, txid, vin, ((typeof tx.vjoinsplit === 'undefined' || tx.vjoinsplit == null) ? [] : tx.vjoinsplit), function(vout, nvin) {
|
||||
lib.syncLoop(vin.length, function (loop) {
|
||||
var i = loop.iteration();
|
||||
update_address(nvin[i].addresses, txid, nvin[i].amount, 'vin', function(){
|
||||
|
||||
+19
-2
@@ -288,7 +288,7 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
|
||||
prepare_vout: function(vout, txid, vin, cb) {
|
||||
prepare_vout: function(vout, txid, vin, vhidden, cb) {
|
||||
var arr_vout = [];
|
||||
var arr_vin = [];
|
||||
arr_vin = vin;
|
||||
@@ -324,7 +324,24 @@ module.exports = {
|
||||
loop.next();
|
||||
}
|
||||
}, function(){
|
||||
if (vout[0].scriptPubKey.type == 'nonstandard') {
|
||||
// check for hidden/anonymous outputs
|
||||
vhidden.forEach(function(vanon, i) {
|
||||
if (vanon.vpub_old > 0) {
|
||||
module.exports.convert_to_satoshi(parseFloat(vanon.vpub_old), function(amount_sat){
|
||||
arr_vout.push({addresses:"private_tx", amount:amount_sat});
|
||||
});
|
||||
} else {
|
||||
module.exports.convert_to_satoshi(parseFloat(vanon.vpub_new), function(amount_sat){
|
||||
if (vhidden.length > 0 && (!vout || vout.length == 0) && (!vin || vin.length == 0)) {
|
||||
// add a private out address for the special case where hidden sender is sending to hidden recipient
|
||||
arr_vout.push({addresses:"private_tx", amount:amount_sat});
|
||||
}
|
||||
arr_vin.push({addresses:"private_tx", amount:amount_sat});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof vout[0] !== 'undefined' && vout[0].scriptPubKey.type == 'nonstandard') {
|
||||
if ( arr_vin.length > 0 && arr_vout.length > 0 ) {
|
||||
if (arr_vin[0].addresses == arr_vout[0].addresses) {
|
||||
//PoS
|
||||
|
||||
@@ -55,6 +55,8 @@ exports.bits = "Bits",
|
||||
exports.nonce = "Nonce",
|
||||
exports.new_coins = "New Coins",
|
||||
exports.proof_of_stake = "PoS",
|
||||
exports.hidden_sender = "Hidden Sender",
|
||||
exports.hidden_recipient = "Hidden Recipient",
|
||||
exports.initial_index_alert = "Indexing is currently incomplete, functionality is limited until index is up-to-date.",
|
||||
|
||||
exports.a_menu_showing = "Showing",
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
"nonce": "Nonce",
|
||||
"new_coins": "New Coins",
|
||||
"proof_of_stake": "PoS",
|
||||
"hidden_sender": "Hidden Sender",
|
||||
"hidden_recipient": "Hidden Recipient",
|
||||
"initial_index_alert": "Indexing is currently incomplete, functionality is limited until index is up-to-date.",
|
||||
|
||||
//address menu
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ function route_get_tx(res, txid) {
|
||||
lib.get_rawtransaction(txid, function(rtx) {
|
||||
if (rtx.txid) {
|
||||
lib.prepare_vin(rtx, function(vin) {
|
||||
lib.prepare_vout(rtx.vout, rtx.txid, vin, function(rvout, rvin) {
|
||||
lib.prepare_vout(rtx.vout, rtx.txid, vin, ((typeof rtx.vjoinsplit === 'undefined' || rtx.vjoinsplit == null) ? [] : rtx.vjoinsplit), function(rvout, rvin) {
|
||||
lib.calculate_total(rvout, function(total){
|
||||
if (!rtx.confirmations > 0) {
|
||||
var utx = {
|
||||
|
||||
+18
-7
@@ -73,9 +73,12 @@ block content
|
||||
else
|
||||
- var ramount = r.amount / 100000000
|
||||
tr
|
||||
td
|
||||
a.loading(href='/address/' + r.addresses)
|
||||
=r.addresses
|
||||
td
|
||||
if r.addresses != 'private_tx'
|
||||
a.loading(href='/address/' + r.addresses)
|
||||
=r.addresses
|
||||
else
|
||||
=settings.locale.hidden_sender
|
||||
td.danger.hidden-xs #{ramount.toFixed(8)}
|
||||
tr.hidden-lg.hidden-md
|
||||
td.danger #{ramount.toFixed(8)} #{settings.symbol}
|
||||
@@ -96,10 +99,18 @@ block content
|
||||
if tx.vout.length > 0
|
||||
- var ramount = r.amount / 100000000
|
||||
tr
|
||||
td
|
||||
a.loading(href='/address/' + r.addresses)
|
||||
=r.addresses
|
||||
td.success.hidden-xs #{ramount.toFixed(8)}
|
||||
if r.addresses != 'private_tx'
|
||||
td
|
||||
a.loading(href='/address/' + r.addresses)
|
||||
=r.addresses
|
||||
td.success.hidden-xs #{ramount.toFixed(8)}
|
||||
else if r.amount > 0
|
||||
td
|
||||
=settings.locale.hidden_recipient
|
||||
td.success.hidden-xs #{ramount.toFixed(8)}
|
||||
else
|
||||
td(colspan='2')
|
||||
=settings.locale.hidden_recipient
|
||||
tr.hidden-lg.hidden-md
|
||||
td.success #{ramount.toFixed(8)} #{settings.symbol}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user