version-1.4

This commit is contained in:
aeonix
2014-07-07 07:07:01 +02:00
parent 8addf7d335
commit d0a4015643
19 changed files with 530 additions and 451 deletions
+13 -3
View File
@@ -10,6 +10,10 @@
#include "account.h"
#include "warnings.h"
#include "crypto/crypto.h"
extern "C"
{
#include "crypto/keccak.h"
}
#include "cryptonote_core/cryptonote_basic_impl.h"
#include "cryptonote_core/cryptonote_format_utils.h"
using namespace std;
@@ -29,11 +33,17 @@ DISABLE_VS_WARNINGS(4244 4345)
m_keys = account_keys();
}
//-----------------------------------------------------------------
void account_base::generate()
crypto::secret_key account_base::generate(const crypto::secret_key& recovery_key, bool recover, bool two_random)
{
generate_keys(m_keys.m_account_address.m_spend_public_key, m_keys.m_spend_secret_key);
generate_keys(m_keys.m_account_address.m_view_public_key, m_keys.m_view_secret_key);
crypto::secret_key first = generate_keys(m_keys.m_account_address.m_spend_public_key, m_keys.m_spend_secret_key, recovery_key, recover);
// rng for generating second set of keys is hash of first rng. means only one set of electrum-style words needed for recovery
crypto::secret_key second;
keccak((uint8_t *)&first, sizeof(crypto::secret_key), (uint8_t *)&second, sizeof(crypto::secret_key));
generate_keys(m_keys.m_account_address.m_view_public_key, m_keys.m_view_secret_key, second, two_random ? false : true);
m_creation_timestamp = time(NULL);
return first;
}
//-----------------------------------------------------------------
const account_keys& account_base::get_keys() const
+1 -1
View File
@@ -31,7 +31,7 @@ namespace cryptonote
{
public:
account_base();
void generate();
crypto::secret_key generate(const crypto::secret_key& recovery_key = crypto::secret_key(), bool recover = false, bool two_random = false);
const account_keys& get_keys() const;
std::string get_public_address_str();
+11 -3
View File
@@ -152,7 +152,7 @@ namespace cryptonote
<< "transaction id = " << get_transaction_hash(tx));
auto it_in_set = key_image_set.find(get_transaction_hash(tx));
CHECK_AND_ASSERT_MES(key_image_set.size(), false, "transaction id not found in key_image set, img=" << txin.k_image << ENDL
CHECK_AND_ASSERT_MES(it_in_set != key_image_set.end(), false, "transaction id not found in key_image set, img=" << txin.k_image << ENDL
<< "transaction id = " << get_transaction_hash(tx));
key_image_set.erase(it_in_set);
if(!key_image_set.size())
@@ -351,7 +351,7 @@ namespace cryptonote
ss << "id: " << txe.first << ENDL
<< "blob_size: " << txd.blob_size << ENDL
<< "fee: " << txd.fee << ENDL
<< "kept_by_block: " << txd.kept_by_block << ENDL
<< "kept_by_block: " << (txd.kept_by_block ? "true":"false") << ENDL
<< "max_used_block_height: " << txd.max_used_block_height << ENDL
<< "max_used_block_id: " << txd.max_used_block_id << ENDL
<< "last_failed_height: " << txd.last_failed_height << ENDL
@@ -363,7 +363,7 @@ namespace cryptonote
<< obj_to_json_str(txd.tx) << ENDL
<< "blob_size: " << txd.blob_size << ENDL
<< "fee: " << txd.fee << ENDL
<< "kept_by_block: " << txd.kept_by_block << ENDL
<< "kept_by_block: " << (txd.kept_by_block ? "true":"false") << ENDL
<< "max_used_block_height: " << txd.max_used_block_height << ENDL
<< "max_used_block_id: " << txd.max_used_block_id << ENDL
<< "last_failed_height: " << txd.last_failed_height << ENDL
@@ -424,6 +424,14 @@ namespace cryptonote
if (tx.second.blob_size > upper_transaction_size_limit)
continue;
// If adding this tx will make the block size
// greater than CRYPTONOTE_GETBLOCKTEMPLATE_MAX
// _BLOCK_SIZE bytes, reject the tx; this will
// keep block sizes from becoming too unwieldly
// to propagate at 60s block times.
if ( (total_size + tx.second.blob_size) > CRYPTONOTE_GETBLOCKTEMPLATE_MAX_BLOCK_SIZE )
continue;
// If adding this tx will make the block size
// greater than 130% of the median, reject the
// tx; this will keep down largely punitive tx