fix unit-tests
This commit is contained in:
@@ -224,7 +224,9 @@ namespace cryptonote
|
||||
FIELD(vout)
|
||||
FIELD(extra)
|
||||
VARINT_FIELD(type)
|
||||
if (type != cryptonote::transaction_type::PROTOCOL) {
|
||||
if (type != cryptonote::transaction_type::UNSET &&
|
||||
type != cryptonote::transaction_type::PROTOCOL) {
|
||||
|
||||
VARINT_FIELD(amount_burnt)
|
||||
if (type != cryptonote::transaction_type::MINER) {
|
||||
if (type == cryptonote::transaction_type::TRANSFER && version >= TRANSACTION_VERSION_N_OUTS) {
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace boost
|
||||
a & x.vout;
|
||||
a & x.extra;
|
||||
a & x.type;
|
||||
if (x.type != cryptonote::transaction_type::PROTOCOL) {
|
||||
if (x.type != cryptonote::transaction_type::PROTOCOL && x.type != cryptonote::transaction_type::UNSET) {
|
||||
a & x.amount_burnt;
|
||||
if (x.type != cryptonote::transaction_type::MINER) {
|
||||
if (x.type == cryptonote::transaction_type::TRANSFER && x.version >= TRANSACTION_VERSION_N_OUTS) {
|
||||
|
||||
@@ -1288,8 +1288,12 @@ namespace cryptonote
|
||||
CHECK_AND_ASSERT_MES(asset_type == "SAL", false, "wrong output asset type:" << asset_type);
|
||||
// LAND AHOY!!!
|
||||
} else if (tx.type == cryptonote::transaction_type::PROTOCOL) {
|
||||
// PROTOCOL TXs are responsible for paying out SAL and SAL1 during the AUDIT
|
||||
CHECK_AND_ASSERT_MES(asset_type == "SAL1" || asset_type == "SAL", false, "wrong output asset type:" << asset_type);
|
||||
if (hf_version < HF_VERSION_AUDIT1_PAUSE) {
|
||||
// PROTOCOL TXs are responsible for paying out SAL and SAL1 during the first AUDIT
|
||||
CHECK_AND_ASSERT_MES(asset_type == "SAL1" || asset_type == "SAL", false, "wrong output asset type:" << asset_type);
|
||||
} else {
|
||||
CHECK_AND_ASSERT_MES(asset_type == "SAL1", false, "wrong output asset type:" << asset_type);
|
||||
}
|
||||
} else {
|
||||
// All other TX types must only spend + create SAL1 (MINER, TRANSFER)
|
||||
CHECK_AND_ASSERT_MES(asset_type == "SAL1", false, "wrong output asset type:" << asset_type);
|
||||
|
||||
@@ -270,7 +270,7 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::t
|
||||
INSERT_INTO_JSON_OBJECT(dest, outputs, tx.vout);
|
||||
INSERT_INTO_JSON_OBJECT(dest, extra, tx.extra);
|
||||
INSERT_INTO_JSON_OBJECT(dest, type, static_cast<uint8_t>(tx.type));
|
||||
if (tx.type != cryptonote::transaction_type::PROTOCOL) {
|
||||
if (tx.type != cryptonote::transaction_type::PROTOCOL && tx.type != cryptonote::transaction_type::UNSET) {
|
||||
INSERT_INTO_JSON_OBJECT(dest, amount_burnt, tx.amount_burnt);
|
||||
if (tx.type != cryptonote::transaction_type::MINER) {
|
||||
if (tx.type == cryptonote::transaction_type::TRANSFER && tx.version >= TRANSACTION_VERSION_N_OUTS) {
|
||||
@@ -313,7 +313,7 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::transaction& tx)
|
||||
uint8_t tx_type = 0;
|
||||
GET_FROM_JSON_OBJECT(val, tx_type, type);
|
||||
tx.type = static_cast<cryptonote::transaction_type>(tx_type);
|
||||
if (tx.type != cryptonote::transaction_type::PROTOCOL) {
|
||||
if (tx.type != cryptonote::transaction_type::PROTOCOL && tx.type != cryptonote::transaction_type::UNSET) {
|
||||
GET_FROM_JSON_OBJECT(val, tx.amount_burnt, amount_burnt);
|
||||
if (tx.type != cryptonote::transaction_type::MINER) {
|
||||
if (tx.type == cryptonote::transaction_type::TRANSFER && tx.version >= TRANSACTION_VERSION_N_OUTS) {
|
||||
|
||||
@@ -113,9 +113,9 @@ using namespace cryptonote;
|
||||
// used to target a given block weight (additional outputs may be added on top to build fee)
|
||||
#define TX_WEIGHT_TARGET(bytes) (bytes*2/3)
|
||||
|
||||
#define UNSIGNED_TX_PREFIX "Monero unsigned tx set\005"
|
||||
#define SIGNED_TX_PREFIX "Monero signed tx set\005"
|
||||
#define MULTISIG_UNSIGNED_TX_PREFIX "Monero multisig unsigned tx set\001"
|
||||
#define UNSIGNED_TX_PREFIX "Salvium unsigned tx set\005"
|
||||
#define SIGNED_TX_PREFIX "Salvium signed tx set\005"
|
||||
#define MULTISIG_UNSIGNED_TX_PREFIX "Salvium multisig unsigned tx set\001"
|
||||
|
||||
#define RECENT_OUTPUT_RATIO (0.5) // 50% of outputs are from the recent zone
|
||||
#define RECENT_OUTPUT_DAYS (1.8) // last 1.8 day makes up the recent zone (taken from monerolink.pdf, Miller et al)
|
||||
@@ -129,11 +129,11 @@ using namespace cryptonote;
|
||||
#define SUBADDRESS_LOOKAHEAD_MAJOR 50
|
||||
#define SUBADDRESS_LOOKAHEAD_MINOR 200
|
||||
|
||||
#define KEY_IMAGE_EXPORT_FILE_MAGIC "Monero key image export\003"
|
||||
#define KEY_IMAGE_EXPORT_FILE_MAGIC "Salvium key image export\003"
|
||||
|
||||
#define MULTISIG_EXPORT_FILE_MAGIC "Monero multisig export\001"
|
||||
#define MULTISIG_EXPORT_FILE_MAGIC "Salvium multisig export\001"
|
||||
|
||||
#define OUTPUT_EXPORT_FILE_MAGIC "Monero output export\004"
|
||||
#define OUTPUT_EXPORT_FILE_MAGIC "Salvium output export\004"
|
||||
|
||||
#define SEGREGATION_FORK_HEIGHT 99999999
|
||||
#define TESTNET_SEGREGATION_FORK_HEIGHT 99999999
|
||||
@@ -15966,13 +15966,13 @@ std::string wallet2::make_uri(const std::string &address, const std::string &pay
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error)
|
||||
{
|
||||
if (uri.substr(0, 7) != "salvium:")
|
||||
if (uri.substr(0, 8) != "salvium:")
|
||||
{
|
||||
error = std::string("URI has wrong scheme (expected \"salvium:\"): ") + uri;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string remainder = uri.substr(7);
|
||||
std::string remainder = uri.substr(8);
|
||||
const char *ptr = strchr(remainder.c_str(), '?');
|
||||
address = ptr ? remainder.substr(0, ptr-remainder.c_str()) : remainder;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user