Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 32dfbcf8ea | |||
| b8d2ba017e | |||
| b18445f6e7 | |||
| bea129bb73 | |||
| 690e900011 | |||
| 516511da69 | |||
| 0aadf3db51 | |||
| be8c2e9c8f | |||
| 66854eb683 |
+8
-8
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cryptoforknote-util",
|
"name": "cryptoforknote-util",
|
||||||
"version": "15.4.0",
|
"version": "15.5.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "LucasJones",
|
"name": "LucasJones",
|
||||||
"email": "lucasjonesdev@hotmail.co.uk"
|
"email": "lucasjonesdev@hotmail.co.uk"
|
||||||
@@ -10,16 +10,16 @@
|
|||||||
"url": "https://github.com/haven-protocol-org/node-cryptoforknote-util.git"
|
"url": "https://github.com/haven-protocol-org/node-cryptoforknote-util.git"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"promise": "*",
|
|
||||||
"bindings": "*",
|
|
||||||
"nan": "^2.14.2",
|
|
||||||
"bignum": "^0.13.1",
|
|
||||||
"sha3": "*",
|
|
||||||
"base58-native": "*",
|
"base58-native": "*",
|
||||||
"bech32": "*",
|
"bech32": "*",
|
||||||
"varuint-bitcoin": "^1.0.4",
|
"bignum": "^0.13.1",
|
||||||
|
"bindings": "*",
|
||||||
|
"bitcoinjs-lib": "git+https://github.com/MoneroOcean/bitcoinjs-lib.git",
|
||||||
"merkle-lib": "^2.0.10",
|
"merkle-lib": "^2.0.10",
|
||||||
"bitcoinjs-lib": "git+https://github.com/MoneroOcean/bitcoinjs-lib.git"
|
"nan": "^2.20.0",
|
||||||
|
"promise": "*",
|
||||||
|
"sha3": "*",
|
||||||
|
"varuint-bitcoin": "^1.0.4"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"cryptonight",
|
"cryptonight",
|
||||||
|
|||||||
@@ -36,4 +36,5 @@ enum BLOB_TYPE {
|
|||||||
BLOB_TYPE_CRYPTONOTE_XTA = 12, // ITALO
|
BLOB_TYPE_CRYPTONOTE_XTA = 12, // ITALO
|
||||||
BLOB_TYPE_CRYPTONOTE_ZEPHYR = 13, // ZEPHYR
|
BLOB_TYPE_CRYPTONOTE_ZEPHYR = 13, // ZEPHYR
|
||||||
BLOB_TYPE_CRYPTONOTE_XLA = 14, // XLA
|
BLOB_TYPE_CRYPTONOTE_XLA = 14, // XLA
|
||||||
|
BLOB_TYPE_CRYPTONOTE_SALVIUM= 15, // Salvium
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -48,7 +48,19 @@ namespace cryptonote
|
|||||||
|
|
||||||
typedef std::vector<crypto::signature> ring_signature;
|
typedef std::vector<crypto::signature> ring_signature;
|
||||||
|
|
||||||
|
enum salvium_transaction_type
|
||||||
|
{
|
||||||
|
UNSET = 0,
|
||||||
|
MINER = 1,
|
||||||
|
PROTOCOL = 2,
|
||||||
|
TRANSFER = 3,
|
||||||
|
CONVERT = 4,
|
||||||
|
BURN = 5,
|
||||||
|
STAKE = 6,
|
||||||
|
RETURN = 7,
|
||||||
|
MAX = 7
|
||||||
|
};
|
||||||
|
|
||||||
/* outputs */
|
/* outputs */
|
||||||
|
|
||||||
struct txout_to_script
|
struct txout_to_script
|
||||||
@@ -167,6 +179,41 @@ namespace cryptonote
|
|||||||
END_SERIALIZE()
|
END_SERIALIZE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// SALVIUM
|
||||||
|
struct txout_salvium_key
|
||||||
|
{
|
||||||
|
txout_salvium_key() { }
|
||||||
|
txout_salvium_key(const crypto::public_key &_key, const std::string &_asset_type, const uint64_t &_unlock_time) :
|
||||||
|
key(_key), asset_type(_asset_type), unlock_time(_unlock_time) { }
|
||||||
|
crypto::public_key key;
|
||||||
|
std::string asset_type;
|
||||||
|
uint64_t unlock_time;
|
||||||
|
|
||||||
|
BEGIN_SERIALIZE_OBJECT()
|
||||||
|
FIELD(key)
|
||||||
|
FIELD(asset_type)
|
||||||
|
VARINT_FIELD(unlock_time)
|
||||||
|
END_SERIALIZE()
|
||||||
|
};
|
||||||
|
|
||||||
|
struct txout_salvium_tagged_key
|
||||||
|
{
|
||||||
|
txout_salvium_tagged_key() { }
|
||||||
|
txout_salvium_tagged_key(const crypto::public_key &_key, const std::string &_asset_type, const uint64_t &_unlock_time, const crypto::view_tag &_view_tag) :
|
||||||
|
key(_key), asset_type(_asset_type), unlock_time(_unlock_time), view_tag(_view_tag) { }
|
||||||
|
crypto::public_key key;
|
||||||
|
std::string asset_type;
|
||||||
|
uint64_t unlock_time;
|
||||||
|
crypto::view_tag view_tag; // optimization to reduce scanning time
|
||||||
|
|
||||||
|
BEGIN_SERIALIZE_OBJECT()
|
||||||
|
FIELD(key)
|
||||||
|
FIELD(asset_type)
|
||||||
|
VARINT_FIELD(unlock_time)
|
||||||
|
FIELD(view_tag)
|
||||||
|
END_SERIALIZE()
|
||||||
|
};
|
||||||
|
|
||||||
/* inputs */
|
/* inputs */
|
||||||
|
|
||||||
struct txin_gen
|
struct txin_gen
|
||||||
@@ -290,11 +337,28 @@ namespace cryptonote
|
|||||||
END_SERIALIZE()
|
END_SERIALIZE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct txin_salvium_key
|
||||||
|
{
|
||||||
|
uint64_t amount;
|
||||||
|
std::string asset_type;
|
||||||
|
std::vector<uint64_t> key_offsets;
|
||||||
|
crypto::key_image k_image; // double spending protection
|
||||||
|
|
||||||
|
BEGIN_SERIALIZE_OBJECT()
|
||||||
|
VARINT_FIELD(amount)
|
||||||
|
FIELD(asset_type)
|
||||||
|
FIELD(key_offsets)
|
||||||
|
FIELD(k_image)
|
||||||
|
END_SERIALIZE()
|
||||||
|
};
|
||||||
|
|
||||||
typedef boost::variant<txin_gen, txin_to_script, txin_to_scripthash, txin_to_key, txin_offshore, txin_onshore, txin_xasset, txin_haven_key> txin_v;
|
typedef boost::variant<txin_gen, txin_to_script, txin_to_scripthash, txin_to_key, txin_offshore, txin_onshore, txin_xasset, txin_haven_key> txin_v;
|
||||||
typedef boost::variant<txin_gen, txin_to_script, txin_to_scripthash, txin_zephyr_key> txin_zephyr_v;
|
typedef boost::variant<txin_gen, txin_to_script, txin_to_scripthash, txin_zephyr_key> txin_zephyr_v;
|
||||||
|
typedef boost::variant<txin_gen, txin_to_script, txin_to_scripthash, txin_salvium_key> txin_salvium_v;
|
||||||
|
|
||||||
typedef boost::variant<txout_to_script, txout_to_scripthash, txout_to_key, txout_to_tagged_key> txout_target_v;
|
typedef boost::variant<txout_to_script, txout_to_scripthash, txout_to_key, txout_to_tagged_key> txout_target_v;
|
||||||
typedef boost::variant<txout_to_script, txout_to_scripthash, txout_to_key, txout_offshore, txout_xasset, txout_haven_key, txout_haven_tagged_key> txout_xhv_target_v;
|
typedef boost::variant<txout_to_script, txout_to_scripthash, txout_to_key, txout_offshore, txout_xasset, txout_haven_key, txout_haven_tagged_key> txout_xhv_target_v;
|
||||||
|
typedef boost::variant<txout_to_script, txout_to_scripthash, txout_salvium_key, txout_salvium_tagged_key> txout_salvium_target_v;
|
||||||
|
|
||||||
typedef boost::variant<txout_to_script, txout_to_scripthash, txout_zephyr_tagged_key> txout_stablero_target_v;
|
typedef boost::variant<txout_to_script, txout_to_scripthash, txout_zephyr_tagged_key> txout_stablero_target_v;
|
||||||
|
|
||||||
@@ -331,6 +395,17 @@ namespace cryptonote
|
|||||||
END_SERIALIZE()
|
END_SERIALIZE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct tx_out_salvium
|
||||||
|
{
|
||||||
|
uint64_t amount;
|
||||||
|
txout_salvium_target_v target;
|
||||||
|
|
||||||
|
BEGIN_SERIALIZE_OBJECT()
|
||||||
|
VARINT_FIELD(amount)
|
||||||
|
FIELD(target)
|
||||||
|
END_SERIALIZE()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
enum loki_version
|
enum loki_version
|
||||||
{
|
{
|
||||||
@@ -352,9 +427,11 @@ namespace cryptonote
|
|||||||
|
|
||||||
std::vector<txin_v> vin;
|
std::vector<txin_v> vin;
|
||||||
std::vector<txin_zephyr_v> vin_zephyr;
|
std::vector<txin_zephyr_v> vin_zephyr;
|
||||||
|
std::vector<txin_salvium_v> vin_salvium;
|
||||||
std::vector<tx_out> vout;
|
std::vector<tx_out> vout;
|
||||||
std::vector<tx_out_xhv> vout_xhv;
|
std::vector<tx_out_xhv> vout_xhv;
|
||||||
std::vector<tx_out_zephyr> vout_zephyr;
|
std::vector<tx_out_zephyr> vout_zephyr;
|
||||||
|
std::vector<tx_out_salvium> vout_salvium;
|
||||||
//extra
|
//extra
|
||||||
std::vector<uint8_t> extra;
|
std::vector<uint8_t> extra;
|
||||||
// Block height to use PR from
|
// Block height to use PR from
|
||||||
@@ -366,6 +443,23 @@ namespace cryptonote
|
|||||||
std::vector<uint64_t> output_unlock_times;
|
std::vector<uint64_t> output_unlock_times;
|
||||||
std::vector<uint32_t> collateral_indices;
|
std::vector<uint32_t> collateral_indices;
|
||||||
|
|
||||||
|
// SALVIUM-SPECIFIC FIELDS
|
||||||
|
// TX type
|
||||||
|
cryptonote::salvium_transaction_type tx_type;
|
||||||
|
// Return address
|
||||||
|
crypto::public_key return_address;
|
||||||
|
// Return TX public key
|
||||||
|
crypto::public_key return_pubkey;
|
||||||
|
// Source asset type
|
||||||
|
std::string source_asset_type;
|
||||||
|
// Destination asset type (this is only necessary for CONVERT transactions)
|
||||||
|
std::string destination_asset_type;
|
||||||
|
// Circulating supply information - already provided by Haven
|
||||||
|
//uint64_t amount_burnt;
|
||||||
|
// Slippage limit
|
||||||
|
uint64_t amount_slippage_limit;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// NOTE: Loki specific
|
// NOTE: Loki specific
|
||||||
//
|
//
|
||||||
@@ -629,7 +723,27 @@ namespace cryptonote
|
|||||||
VARINT_FIELD(pricing_record_height)
|
VARINT_FIELD(pricing_record_height)
|
||||||
VARINT_FIELD(amount_burnt)
|
VARINT_FIELD(amount_burnt)
|
||||||
VARINT_FIELD(amount_minted)
|
VARINT_FIELD(amount_minted)
|
||||||
|
|
||||||
|
} else if (blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) {
|
||||||
|
|
||||||
|
VARINT_FIELD(version)
|
||||||
|
//if(version == 0 || CURRENT_TRANSACTION_VERSION < version) return false;
|
||||||
|
VARINT_FIELD(unlock_time)
|
||||||
|
FIELD(vin_salvium)
|
||||||
|
FIELD(vout_salvium)
|
||||||
|
FIELD(extra)
|
||||||
|
VARINT_FIELD(tx_type)
|
||||||
|
if (tx_type != cryptonote::salvium_transaction_type::PROTOCOL) {
|
||||||
|
VARINT_FIELD(amount_burnt)
|
||||||
|
if (tx_type != cryptonote::salvium_transaction_type::MINER) {
|
||||||
|
FIELD(return_address)
|
||||||
|
FIELD(return_pubkey)
|
||||||
|
FIELD(source_asset_type)
|
||||||
|
FIELD(destination_asset_type)
|
||||||
|
VARINT_FIELD(amount_slippage_limit)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
VARINT_FIELD(version)
|
VARINT_FIELD(version)
|
||||||
@@ -722,7 +836,7 @@ namespace cryptonote
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ar.tag("rct_signatures");
|
ar.tag("rct_signatures");
|
||||||
if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? !vin_zephyr.empty() : !vin.empty())
|
if (blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? !vin_salvium.empty() : (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? !vin_zephyr.empty() : !vin.empty()))
|
||||||
{
|
{
|
||||||
ar.begin_object();
|
ar.begin_object();
|
||||||
bool r;
|
bool r;
|
||||||
@@ -730,6 +844,8 @@ namespace cryptonote
|
|||||||
r = rct_signatures.serialize_rctsig_base(ar, vin.size(), vout_xhv.size());
|
r = rct_signatures.serialize_rctsig_base(ar, vin.size(), vout_xhv.size());
|
||||||
else if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR)
|
else if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR)
|
||||||
r = rct_signatures.serialize_rctsig_base(ar, vin_zephyr.size(), vout_zephyr.size());
|
r = rct_signatures.serialize_rctsig_base(ar, vin_zephyr.size(), vout_zephyr.size());
|
||||||
|
else if (blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM)
|
||||||
|
r = rct_signatures.serialize_rctsig_base(ar, vin_salvium.size(), vout_salvium.size());
|
||||||
else
|
else
|
||||||
r = rct_signatures.serialize_rctsig_base(ar, vin.size(), vout.size());
|
r = rct_signatures.serialize_rctsig_base(ar, vin.size(), vout.size());
|
||||||
if (!r || !ar.stream().good()) return false;
|
if (!r || !ar.stream().good()) return false;
|
||||||
@@ -741,6 +857,9 @@ namespace cryptonote
|
|||||||
if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR) {
|
if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR) {
|
||||||
r = rct_signatures.p.serialize_rctsig_prunable(ar, rct_signatures.type, vin_zephyr.size(), vout_zephyr.size(),
|
r = rct_signatures.p.serialize_rctsig_prunable(ar, rct_signatures.type, vin_zephyr.size(), vout_zephyr.size(),
|
||||||
vin_zephyr[0].type() == typeid(txin_zephyr_key) ? boost::get<txin_zephyr_key>(vin_zephyr[0]).key_offsets.size() - 1 : 0);
|
vin_zephyr[0].type() == typeid(txin_zephyr_key) ? boost::get<txin_zephyr_key>(vin_zephyr[0]).key_offsets.size() - 1 : 0);
|
||||||
|
} else if (blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) {
|
||||||
|
r = rct_signatures.p.serialize_rctsig_prunable(ar, rct_signatures.type, vin_salvium.size(), vout_salvium.size(),
|
||||||
|
vin_salvium[0].type() == typeid(txin_salvium_key) ? boost::get<txin_salvium_key>(vin_salvium[0]).key_offsets.size() - 1 : 0);
|
||||||
} else if (blob_type == BLOB_TYPE_CRYPTONOTE_XHV) {
|
} else if (blob_type == BLOB_TYPE_CRYPTONOTE_XHV) {
|
||||||
r = rct_signatures.p.serialize_rctsig_prunable(ar, rct_signatures.type, vin.size(), vout_xhv.size(),
|
r = rct_signatures.p.serialize_rctsig_prunable(ar, rct_signatures.type, vin.size(), vout_xhv.size(),
|
||||||
vin.size() > 0 && vin[0].type() == typeid(txin_to_key) ? boost::get<txin_to_key>(vin[0]).key_offsets.size() - 1 :
|
vin.size() > 0 && vin[0].type() == typeid(txin_to_key) ? boost::get<txin_to_key>(vin[0]).key_offsets.size() - 1 :
|
||||||
@@ -956,7 +1075,7 @@ namespace cryptonote
|
|||||||
if (blob_type == BLOB_TYPE_CRYPTONOTE_XTNC || blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO) FIELD(cycle)
|
if (blob_type == BLOB_TYPE_CRYPTONOTE_XTNC || blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO) FIELD(cycle)
|
||||||
if (blob_type == BLOB_TYPE_CRYPTONOTE_TUBE) FIELD(cycle40)
|
if (blob_type == BLOB_TYPE_CRYPTONOTE_TUBE) FIELD(cycle40)
|
||||||
if (blob_type == BLOB_TYPE_CRYPTONOTE_XTA) FIELD(cycle48)
|
if (blob_type == BLOB_TYPE_CRYPTONOTE_XTA) FIELD(cycle48)
|
||||||
if (blob_type == BLOB_TYPE_CRYPTONOTE_XHV) FIELD(pricing_record)
|
if (blob_type == BLOB_TYPE_CRYPTONOTE_XHV || blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) FIELD(pricing_record)
|
||||||
if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR) {
|
if (blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR) {
|
||||||
if (major_version >= 4)
|
if (major_version >= 4)
|
||||||
{
|
{
|
||||||
@@ -1001,10 +1120,11 @@ namespace cryptonote
|
|||||||
bytecoin_block parent_block;
|
bytecoin_block parent_block;
|
||||||
|
|
||||||
transaction miner_tx;
|
transaction miner_tx;
|
||||||
|
transaction protocol_tx;
|
||||||
std::vector<crypto::hash> tx_hashes;
|
std::vector<crypto::hash> tx_hashes;
|
||||||
mutable crypto::hash uncle = cryptonote::null_hash;
|
mutable crypto::hash uncle = cryptonote::null_hash;
|
||||||
|
|
||||||
void set_blob_type(enum BLOB_TYPE bt) { miner_tx.blob_type = blob_type = bt; }
|
void set_blob_type(enum BLOB_TYPE bt) { miner_tx.blob_type = protocol_tx.blob_type = blob_type = bt; }
|
||||||
|
|
||||||
BEGIN_SERIALIZE_OBJECT()
|
BEGIN_SERIALIZE_OBJECT()
|
||||||
FIELDS(*static_cast<block_header *>(this))
|
FIELDS(*static_cast<block_header *>(this))
|
||||||
@@ -1014,6 +1134,10 @@ namespace cryptonote
|
|||||||
FIELD_N("parent_block", sbb);
|
FIELD_N("parent_block", sbb);
|
||||||
}
|
}
|
||||||
FIELD(miner_tx)
|
FIELD(miner_tx)
|
||||||
|
if (blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM)
|
||||||
|
{
|
||||||
|
FIELD(protocol_tx)
|
||||||
|
}
|
||||||
FIELD(tx_hashes)
|
FIELD(tx_hashes)
|
||||||
if (blob_type == BLOB_TYPE_CRYPTONOTE3)
|
if (blob_type == BLOB_TYPE_CRYPTONOTE3)
|
||||||
{
|
{
|
||||||
@@ -1075,14 +1199,17 @@ VARIANT_TAG(binary_archive, cryptonote::txin_to_scripthash, 0x1);
|
|||||||
VARIANT_TAG(binary_archive, cryptonote::txin_to_key, 0x2);
|
VARIANT_TAG(binary_archive, cryptonote::txin_to_key, 0x2);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txin_zephyr_key, 0x2);
|
VARIANT_TAG(binary_archive, cryptonote::txin_zephyr_key, 0x2);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txin_offshore, 0x3);
|
VARIANT_TAG(binary_archive, cryptonote::txin_offshore, 0x3);
|
||||||
|
VARIANT_TAG(binary_archive, cryptonote::txin_salvium_key, 0x2);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txin_onshore, 0x4);
|
VARIANT_TAG(binary_archive, cryptonote::txin_onshore, 0x4);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txin_xasset, 0x5);
|
VARIANT_TAG(binary_archive, cryptonote::txin_xasset, 0x5);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txin_haven_key, 0x6);
|
VARIANT_TAG(binary_archive, cryptonote::txin_haven_key, 0x6);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txout_to_script, 0x0);
|
VARIANT_TAG(binary_archive, cryptonote::txout_to_script, 0x0);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txout_to_scripthash, 0x1);
|
VARIANT_TAG(binary_archive, cryptonote::txout_to_scripthash, 0x1);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txout_to_key, 0x2);
|
VARIANT_TAG(binary_archive, cryptonote::txout_to_key, 0x2);
|
||||||
|
VARIANT_TAG(binary_archive, cryptonote::txout_salvium_key, 0x2);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txout_zephyr_tagged_key, 0x2);
|
VARIANT_TAG(binary_archive, cryptonote::txout_zephyr_tagged_key, 0x2);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txout_to_tagged_key, 0x3);
|
VARIANT_TAG(binary_archive, cryptonote::txout_to_tagged_key, 0x3);
|
||||||
|
VARIANT_TAG(binary_archive, cryptonote::txout_salvium_tagged_key, 0x3);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txout_offshore, 0x3);
|
VARIANT_TAG(binary_archive, cryptonote::txout_offshore, 0x3);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txout_xasset, 0x5);
|
VARIANT_TAG(binary_archive, cryptonote::txout_xasset, 0x5);
|
||||||
VARIANT_TAG(binary_archive, cryptonote::txout_haven_key, 0x6);
|
VARIANT_TAG(binary_archive, cryptonote::txout_haven_key, 0x6);
|
||||||
|
|||||||
@@ -220,8 +220,8 @@ namespace cryptonote
|
|||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
binary_archive<true> ba(ss);
|
binary_archive<true> ba(ss);
|
||||||
const size_t inputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vin_zephyr.size() : t.vin.size();
|
const size_t inputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vin_salvium.size() : (t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vin_zephyr.size() : t.vin.size());
|
||||||
const size_t outputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vout_zephyr.size() : t.blob_type != BLOB_TYPE_CRYPTONOTE_XHV ? t.vout.size() : t.vout_xhv.size();
|
const size_t outputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vout_salvium.size() : (t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vout_zephyr.size() : (t.blob_type != BLOB_TYPE_CRYPTONOTE_XHV ? t.vout.size() : t.vout_xhv.size()));
|
||||||
bool r = tt.rct_signatures.serialize_rctsig_base(ba, inputs, outputs);
|
bool r = tt.rct_signatures.serialize_rctsig_base(ba, inputs, outputs);
|
||||||
CHECK_AND_ASSERT_MES(r, false, "Failed to serialize rct signatures base");
|
CHECK_AND_ASSERT_MES(r, false, "Failed to serialize rct signatures base");
|
||||||
cryptonote::get_blob_hash(ss.str(), hashes[1]);
|
cryptonote::get_blob_hash(ss.str(), hashes[1]);
|
||||||
@@ -236,10 +236,12 @@ namespace cryptonote
|
|||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
binary_archive<true> ba(ss);
|
binary_archive<true> ba(ss);
|
||||||
const size_t inputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vin_zephyr.size() : t.vin.size();
|
const size_t inputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vin_salvium.size() : (t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vin_zephyr.size() : t.vin.size());
|
||||||
const size_t outputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vout_zephyr.size() : t.blob_type != BLOB_TYPE_CRYPTONOTE_XHV ? t.vout.size() : t.vout_xhv.size();
|
const size_t outputs = t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM ? t.vout_salvium.size() : (t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR ? t.vout_zephyr.size() : (t.blob_type != BLOB_TYPE_CRYPTONOTE_XHV ? t.vout.size() : t.vout_xhv.size()));
|
||||||
size_t mixin;
|
size_t mixin;
|
||||||
if (t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR) {
|
if (t.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) {
|
||||||
|
mixin = t.vin_salvium.empty() ? 0 : t.vin_salvium[0].type() == typeid(txin_salvium_key) ? boost::get<txin_salvium_key>(t.vin_salvium[0]).key_offsets.size() - 1 : 0;
|
||||||
|
} else if (t.blob_type == BLOB_TYPE_CRYPTONOTE_ZEPHYR) {
|
||||||
mixin = t.vin_zephyr.empty() ? 0 : t.vin_zephyr[0].type() == typeid(txin_zephyr_key) ? boost::get<txin_zephyr_key>(t.vin_zephyr[0]).key_offsets.size() - 1 : 0;
|
mixin = t.vin_zephyr.empty() ? 0 : t.vin_zephyr[0].type() == typeid(txin_zephyr_key) ? boost::get<txin_zephyr_key>(t.vin_zephyr[0]).key_offsets.size() - 1 : 0;
|
||||||
} else if (t.blob_type == BLOB_TYPE_CRYPTONOTE_XHV) {
|
} else if (t.blob_type == BLOB_TYPE_CRYPTONOTE_XHV) {
|
||||||
mixin = t.vin.empty() ? 0 :
|
mixin = t.vin.empty() ? 0 :
|
||||||
@@ -285,7 +287,11 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
crypto::hash tree_root_hash = get_tx_tree_hash(b);
|
crypto::hash tree_root_hash = get_tx_tree_hash(b);
|
||||||
blob.append(reinterpret_cast<const char*>(&tree_root_hash), sizeof(tree_root_hash));
|
blob.append(reinterpret_cast<const char*>(&tree_root_hash), sizeof(tree_root_hash));
|
||||||
blob.append(tools::get_varint_data(b.tx_hashes.size()+1));
|
if (b.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) {
|
||||||
|
blob.append(tools::get_varint_data(b.tx_hashes.size()+2));
|
||||||
|
} else {
|
||||||
|
blob.append(tools::get_varint_data(b.tx_hashes.size()+1));
|
||||||
|
}
|
||||||
if (b.blob_type == BLOB_TYPE_CRYPTONOTE3) {
|
if (b.blob_type == BLOB_TYPE_CRYPTONOTE3) {
|
||||||
blob.append(reinterpret_cast<const char*>(&b.uncle), sizeof(b.uncle));
|
blob.append(reinterpret_cast<const char*>(&b.uncle), sizeof(b.uncle));
|
||||||
}
|
}
|
||||||
@@ -413,6 +419,12 @@ namespace cryptonote
|
|||||||
crypto::hash h = null_hash;
|
crypto::hash h = null_hash;
|
||||||
size_t bl_sz = 0;
|
size_t bl_sz = 0;
|
||||||
get_transaction_hash(b.miner_tx, h, bl_sz);
|
get_transaction_hash(b.miner_tx, h, bl_sz);
|
||||||
|
if (b.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) {
|
||||||
|
txs_ids.push_back(h);
|
||||||
|
h = null_hash;
|
||||||
|
bl_sz = 0;
|
||||||
|
get_transaction_hash(b.protocol_tx, h, bl_sz);
|
||||||
|
}
|
||||||
txs_ids.push_back(h);
|
txs_ids.push_back(h);
|
||||||
BOOST_FOREACH(auto& th, b.tx_hashes)
|
BOOST_FOREACH(auto& th, b.tx_hashes)
|
||||||
txs_ids.push_back(th);
|
txs_ids.push_back(th);
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ namespace rct {
|
|||||||
typedef std::vector<key> keyV; //vector of keys
|
typedef std::vector<key> keyV; //vector of keys
|
||||||
typedef std::vector<keyV> keyM; //matrix of keys (indexed by column first)
|
typedef std::vector<keyV> keyM; //matrix of keys (indexed by column first)
|
||||||
|
|
||||||
|
static key null_key = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
//containers For CT operations
|
//containers For CT operations
|
||||||
//if it's representing a private ctkey then "dest" contains the secret key of the address
|
//if it's representing a private ctkey then "dest" contains the secret key of the address
|
||||||
// while "mask" contains a where C = aG + bH is CT pedersen commitment and b is the amount
|
// while "mask" contains a where C = aG + bH is CT pedersen commitment and b is the amount
|
||||||
@@ -325,6 +327,7 @@ namespace rct {
|
|||||||
xmr_amount txnOffshoreFee_usd = 0;
|
xmr_amount txnOffshoreFee_usd = 0;
|
||||||
xmr_amount txnOffshoreFee_xasset = 0;
|
xmr_amount txnOffshoreFee_xasset = 0;
|
||||||
keyV maskSums; // contains 2 or 3 elements. 1. is the sum of masks of inputs. 2. is the sum of masks of change outputs. 3. mask of the col output.
|
keyV maskSums; // contains 2 or 3 elements. 1. is the sum of masks of inputs. 2. is the sum of masks of change outputs. 3. mask of the col output.
|
||||||
|
key p_r;
|
||||||
|
|
||||||
template<bool W, template <bool> class Archive>
|
template<bool W, template <bool> class Archive>
|
||||||
bool serialize_rctsig_base(Archive<W> &ar, size_t inputs, size_t outputs)
|
bool serialize_rctsig_base(Archive<W> &ar, size_t inputs, size_t outputs)
|
||||||
@@ -384,6 +387,8 @@ namespace rct {
|
|||||||
FIELDS(maskSums[2])
|
FIELDS(maskSums[2])
|
||||||
ar.end_array();
|
ar.end_array();
|
||||||
}
|
}
|
||||||
|
if (crypto_verify_32(p_r.bytes, null_key.bytes))
|
||||||
|
FIELD(p_r)
|
||||||
return ar.stream().good();
|
return ar.stream().good();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user