Permalink
Browse files

Bytecoin v.2.0.2 release

  • Loading branch information...
Antonio Juarez
Antonio Juarez committed May 18, 2017
1 parent d56f1c5 commit abca08734ce2518257fb8beb3b48431e46e59c8e
@@ -1,3 +1,10 @@
Release notes 2.0.2
- Security algorithm enhancement
- Daemon synchronization issue fix
- Wallet minor bug fixes
- Bytecoin RPC Wallet log optimization
Release notes 2.0.1
- Bytecoin RPC Wallet API improvements
@@ -70,6 +70,7 @@ const size_t FUSION_TX_MAX_SIZE = CRYPTONOTE_BLOCK_
const size_t FUSION_TX_MIN_INPUT_COUNT = 12;
const size_t FUSION_TX_MIN_IN_OUT_COUNT_RATIO = 4;
const uint32_t KEY_IMAGE_CHECKING_BLOCK_INDEX = 1267000;
const uint32_t UPGRADE_HEIGHT_V2 = 546602;
const uint32_t UPGRADE_HEIGHT_V3 = 985548;
const unsigned UPGRADE_VOTING_THRESHOLD = 90; // percent
@@ -180,7 +181,8 @@ const CheckpointData CHECKPOINTS[] = {
{996000, "c9a9243049acc7773a3e58ae354d66f8ea83996ece93ffbaad0b8b42b5fb7223"},
{1021000, "a0c4107d327ffeb31dabe135a7124191b0a5ef7c4fa34f06babc1f0546ab938e"},
{1039000, "8c9208940fc92539fac98cc658b95d240635f8729ee8bd756d6bdbab52de2c04"},
{1170000, "f48441157749e89687dfa6edec2128ff332bdaa9eb139f2330a193e3139d2980"}
{1170000, "f48441157749e89687dfa6edec2128ff332bdaa9eb139f2330a193e3139d2980"},
{1268000, "d49fcaec1d53095e2c244913f123bfd4b26eabb6d75aca7b77a00de8aa8ac680"}
};
} // CryptoNote
@@ -1246,7 +1246,8 @@ std::error_code Core::validateTransaction(const CachedTransaction& cachedTransac
outputKeyPointers.reserve(outputKeys.size());
std::for_each(outputKeys.begin(), outputKeys.end(), [&outputKeyPointers] (const Crypto::PublicKey& key) { outputKeyPointers.push_back(&key); });
if (!Crypto::check_ring_signature(cachedTransaction.getTransactionPrefixHash(), in.keyImage, outputKeyPointers.data(),
outputKeyPointers.size(), transaction.signatures[inputIndex].data())) {
outputKeyPointers.size(), transaction.signatures[inputIndex].data(),
blockIndex > parameters::KEY_IMAGE_CHECKING_BLOCK_INDEX)) {

This comment has been minimized.

@daira

daira May 21, 2017

What is the rationale for allowing the exploit transactions up to block 1267000 to remain valid?

(No other CryptoNote coin did that, if my understanding is correct.)

This comment has been minimized.

@daira
return error::TransactionValidationError::INPUT_INVALID_SIGNATURES;
}
}
@@ -44,6 +44,7 @@
using namespace Crypto;
using namespace Common;
using namespace Logging;
using namespace System;
namespace CryptoNote {
@@ -61,7 +62,8 @@ std::error_code interpretResponseStatus(const std::string& status) {
}
NodeRpcProxy::NodeRpcProxy(const std::string& nodeHost, unsigned short nodePort) :
NodeRpcProxy::NodeRpcProxy(const std::string& nodeHost, unsigned short nodePort, Logging::ILogger& logger) :
m_logger(logger, "NodeRpcProxy"),
m_rpcTimeout(10000),
m_pullInterval(5000),
m_nodeHost(nodeHost),
@@ -519,9 +521,13 @@ std::error_code NodeRpcProxy::doGetRandomOutsByAmounts(std::vector<uint64_t>& am
req.amounts = std::move(amounts);
req.outs_count = outsCount;
m_logger(TRACE) << "Send getrandom_outs.bin request";
std::error_code ec = binaryCommand("/getrandom_outs.bin", req, rsp);
if (!ec) {
m_logger(TRACE) << "getrandom_outs.bin compete";
outs = std::move(rsp.outs);
} else {
m_logger(TRACE) << "getrandom_outs.bin failed: " << ec << ", " << ec.message();
}
return ec;
@@ -541,10 +547,14 @@ std::error_code NodeRpcProxy::doGetNewBlocks(std::vector<Crypto::Hash>& knownBlo
CryptoNote::COMMAND_RPC_GET_BLOCKS_FAST::response rsp = AUTO_VAL_INIT(rsp);
req.block_ids = std::move(knownBlockIds);
m_logger(TRACE) << "Send getblocks.bin request";
std::error_code ec = binaryCommand("/getblocks.bin", req, rsp);
if (!ec) {
m_logger(TRACE) << "getblocks.bin compete, start_height " << rsp.start_height << ", block count " << rsp.blocks.size();
newBlocks = std::move(rsp.blocks);
startHeight = static_cast<uint32_t>(rsp.start_height);
} else {
m_logger(TRACE) << "getblocks.bin failed: " << ec << ", " << ec.message();
}
return ec;
@@ -556,12 +566,16 @@ std::error_code NodeRpcProxy::doGetTransactionOutsGlobalIndices(const Crypto::Ha
CryptoNote::COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES::response rsp = AUTO_VAL_INIT(rsp);
req.txid = transactionHash;
m_logger(TRACE) << "Send get_o_indexes.bin request, transaction " << req.txid;
std::error_code ec = binaryCommand("/get_o_indexes.bin", req, rsp);
if (!ec) {
m_logger(TRACE) << "get_o_indexes.bin compete";
outsGlobalIndices.clear();
for (auto idx : rsp.o_indexes) {
outsGlobalIndices.push_back(static_cast<uint32_t>(idx));
}
} else {
m_logger(TRACE) << "get_o_indexes.bin failed: " << ec << ", " << ec.message();
}
return ec;
@@ -575,11 +589,14 @@ std::error_code NodeRpcProxy::doQueryBlocksLite(const std::vector<Crypto::Hash>&
req.blockIds = knownBlockIds;
req.timestamp = timestamp;
m_logger(TRACE) << "Send queryblockslite.bin request, timestamp " << req.timestamp;
std::error_code ec = binaryCommand("/queryblockslite.bin", req, rsp);
if (ec) {
m_logger(TRACE) << "queryblockslite.bin failed: " << ec << ", " << ec.message();
return ec;
}
m_logger(TRACE) << "queryblockslite.bin compete, startHeight " << rsp.startHeight << ", block count " << rsp.items.size();
startHeight = static_cast<uint32_t>(rsp.startHeight);
for (auto& item: rsp.items) {
@@ -616,12 +633,15 @@ std::error_code NodeRpcProxy::doGetPoolSymmetricDifference(std::vector<Crypto::H
req.tailBlockId = knownBlockId;
req.knownTxsIds = knownPoolTxIds;
m_logger(TRACE) << "Send get_pool_changes_lite.bin request, tailBlockId " << req.tailBlockId;
std::error_code ec = binaryCommand("/get_pool_changes_lite.bin", req, rsp);
if (ec) {
m_logger(TRACE) << "get_pool_changes_lite.bin failed: " << ec << ", " << ec.message();
return ec;
}
m_logger(TRACE) << "get_pool_changes_lite.bin compete, isTailBlockActual " << rsp.isTailBlockActual;
isBcActual = rsp.isTailBlockActual;
deletedTxIds = std::move(rsp.deletedTxsIds);
@@ -25,6 +25,7 @@
#include <unordered_set>
#include "Common/ObserverManager.h"
#include "Logging/LoggerRef.h"
#include "INode.h"
namespace System {
@@ -45,7 +46,7 @@ class INodeRpcProxyObserver {
class NodeRpcProxy : public CryptoNote::INode {
public:
NodeRpcProxy(const std::string& nodeHost, unsigned short nodePort);
NodeRpcProxy(const std::string& nodeHost, unsigned short nodePort, Logging::ILogger& logger);
virtual ~NodeRpcProxy();
virtual bool addObserver(CryptoNote::INodeObserver* observer) override;
@@ -128,6 +129,7 @@ class NodeRpcProxy : public CryptoNote::INode {
};
private:
Logging::LoggerRef m_logger;
State m_state = STATE_NOT_INITIALIZED;
mutable std::mutex m_mutex;
std::condition_variable m_cv_initialized;
@@ -117,8 +117,8 @@ NodeFactory::NodeFactory() {
NodeFactory::~NodeFactory() {
}
CryptoNote::INode* NodeFactory::createNode(const std::string& daemonAddress, uint16_t daemonPort) {
std::unique_ptr<CryptoNote::INode> node(new CryptoNote::NodeRpcProxy(daemonAddress, daemonPort));
CryptoNote::INode* NodeFactory::createNode(const std::string& daemonAddress, uint16_t daemonPort, Logging::ILogger& logger) {
std::unique_ptr<CryptoNote::INode> node(new CryptoNote::NodeRpcProxy(daemonAddress, daemonPort, logger));
NodeInitObserver initObserver;
node->init(std::bind(&NodeInitObserver::initCompleted, &initObserver, std::placeholders::_1));
@@ -21,11 +21,13 @@
#include <string>
#include "Logging/LoggerRef.h"
namespace PaymentService {
class NodeFactory {
public:
static CryptoNote::INode* createNode(const std::string& daemonAddress, uint16_t daemonPort);
static CryptoNote::INode* createNode(const std::string& daemonAddress, uint16_t daemonPort, Logging::ILogger& logger);
static CryptoNote::INode* createNodeStub();
private:
NodeFactory();
@@ -1109,8 +1109,7 @@ void WalletService::replaceWithNewWallet(const Crypto::SecretKey& viewSecretKey)
transactionIdIndex.clear();
size_t i = 0;
for (;;) {
for (size_t i = 0; ; ++i) {
boost::system::error_code ec;
std::string backup = config.walletFile + ".backup";
if (i != 0) {
@@ -243,7 +243,8 @@ void PaymentGateService::runRpcProxy(Logging::LoggerRef& log) {
std::unique_ptr<CryptoNote::INode> node(
PaymentService::NodeFactory::createNode(
config.remoteNodeConfig.daemonHost,
config.remoteNodeConfig.daemonPort));
config.remoteNodeConfig.daemonPort,
log.getLogger()));
runWalletService(currency, *node);
}
@@ -136,9 +136,12 @@ RpcServer::RpcServer(System::Dispatcher& dispatcher, Logging::ILogger& log, Core
}
void RpcServer::processRequest(const HttpRequest& request, HttpResponse& response) {
logger(TRACE) << "RPC request came: \n" << request << std::endl;
auto url = request.getUrl();
if (url.find(".bin") == std::string::npos) {
logger(TRACE) << "RPC request came: \n" << request << std::endl;
} else {
logger(TRACE) << "RPC request came: " << url << std::endl;
}
auto it = s_handlers.find(url);
if (it == s_handlers.end()) {
@@ -586,7 +586,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) {
return false;
}
this->m_node.reset(new NodeRpcProxy(m_daemon_host, m_daemon_port));
this->m_node.reset(new NodeRpcProxy(m_daemon_host, m_daemon_port, logger.getLogger()));
std::promise<std::error_code> errorPromise;
std::future<std::error_code> f_error = errorPromise.get_future();
@@ -1171,7 +1171,7 @@ int main(int argc, char* argv[]) {
}
}
std::unique_ptr<INode> node(new NodeRpcProxy(daemon_host, daemon_port));
std::unique_ptr<INode> node(new NodeRpcProxy(daemon_host, daemon_port, logger.getLogger()));
std::promise<std::error_code> errorPromise;
std::future<std::error_code> error = errorPromise.get_future();
@@ -21,6 +21,7 @@
#include "CommonTypes.h"
#include "Common/BlockingQueue.h"
#include "CryptoNoteCore/CryptoNoteBasicImpl.h"
#include "CryptoNoteCore/CryptoNoteFormatUtils.h"
#include "CryptoNoteCore/TransactionApi.h"
@@ -29,6 +30,7 @@
#include <future>
using namespace Crypto;
using namespace Logging;
namespace {
@@ -479,6 +481,8 @@ std::error_code TransfersConsumer::processTransaction(const TransactionBlockInfo
void TransfersConsumer::processTransaction(const TransactionBlockInfo& blockInfo, const ITransactionReader& tx, const PreprocessInfo& info) {
std::vector<TransactionOutputInformationIn> emptyOutputs;
std::vector<ITransfersContainer*> transactionContainers;
m_logger(TRACE) << "Process transaction, block " << blockInfo.height << ", transaction index " << blockInfo.transactionIndex << ", hash " << tx.getTransactionHash();
bool someContainerUpdated = false;
for (auto& kv : m_subscriptions) {
auto it = info.outputs.find(kv.first);
@@ -494,7 +498,10 @@ void TransfersConsumer::processTransaction(const TransactionBlockInfo& blockInfo
}
if (someContainerUpdated) {
m_logger(TRACE) << "Transaction updated some containers, hash " << tx.getTransactionHash();
m_observerManager.notify(&IBlockchainConsumerObserver::onTransactionUpdated, this, tx.getTransactionHash(), transactionContainers);
} else {
m_logger(TRACE) << "Transaction doesn't updated any container, hash " << tx.getTransactionHash();
}
}
@@ -519,7 +526,7 @@ void TransfersConsumer::processOutputs(const TransactionBlockInfo& blockInfo, Tr
}
}
std::error_code TransfersConsumer::getGlobalIndices(const Hash& transactionHash, std::vector<uint32_t>& outsGlobalIndices) {
std::error_code TransfersConsumer::getGlobalIndices(const Hash& transactionHash, std::vector<uint32_t>& outsGlobalIndices) {
std::promise<std::error_code> prom;
std::future<std::error_code> f = prom.get_future();
@@ -181,8 +181,6 @@ bool TransfersContainer::addTransaction(const TransactionBlockInfo& block, const
try {
std::unique_lock<std::mutex> lock(m_mutex);
m_logger(TRACE) << "Adding transaction, block " << block.height << ", transaction index " << block.transactionIndex << ", hash " << tx.getTransactionHash();
if (block.height < m_currentHeight) {
auto message = "Failed to add transaction: block index < m_currentHeight";
m_logger(ERROR, BRIGHT_RED) << message << ", block " << block.height << ", m_currentHeight " << m_currentHeight;
@@ -200,8 +198,6 @@ bool TransfersContainer::addTransaction(const TransactionBlockInfo& block, const
if (added) {
addTransaction(block, tx);
} else {
m_logger(TRACE) << "Transaction not added";
}
if (block.height != WALLET_LEGACY_UNCONFIRMED_TRANSACTION_HEIGHT) {
@@ -17,13 +17,17 @@
#include "TransfersSubscription.h"
#include "IWalletLegacy.h"
#include "CryptoNoteCore/CryptoNoteBasicImpl.h"
using namespace Crypto;
using namespace Logging;
namespace CryptoNote {
TransfersSubscription::TransfersSubscription(const CryptoNote::Currency& currency, Logging::ILogger& logger, const AccountSubscription& sub)
: subscription(sub), logger(logger, "TransfersSubscription"), transfers(currency, logger, sub.transactionSpendableAge) {}
: subscription(sub), logger(logger, "TransfersSubscription"), transfers(currency, logger, sub.transactionSpendableAge),
m_address(currency.accountAddressAsString(sub.keys.address)) {
}
SynchronizationStart TransfersSubscription::getSyncStart() {
@@ -33,6 +37,7 @@ SynchronizationStart TransfersSubscription::getSyncStart() {
void TransfersSubscription::onBlockchainDetach(uint32_t height) {
std::vector<Hash> deletedTransactions = transfers.detach(height);
for (auto& hash : deletedTransactions) {
logger(TRACE) << "Transaction deleted from wallet " << m_address << ", hash " << hash;
m_observerManager.notify(&ITransfersObserver::onTransactionDeleted, this, hash);
}
}
@@ -56,6 +61,7 @@ bool TransfersSubscription::addTransaction(const TransactionBlockInfo& blockInfo
const std::vector<TransactionOutputInformationIn>& transfersList) {
bool added = transfers.addTransaction(blockInfo, tx, transfersList);
if (added) {
logger(TRACE) << "Transaction updates balance of wallet " << m_address << ", hash " << tx.getTransactionHash();
m_observerManager.notify(&ITransfersObserver::onTransactionUpdated, this, tx.getTransactionHash());
}
@@ -72,6 +78,7 @@ ITransfersContainer& TransfersSubscription::getContainer() {
void TransfersSubscription::deleteUnconfirmedTransaction(const Hash& transactionHash) {
if (transfers.deleteUnconfirmedTransaction(transactionHash)) {
logger(TRACE) << "Transaction deleted from wallet " << m_address << ", hash " << transactionHash;
m_observerManager.notify(&ITransfersObserver::onTransactionDeleted, this, transactionHash);
}
}
@@ -48,6 +48,7 @@ class TransfersSubscription : public IObservableImpl < ITransfersObserver, ITran
Logging::LoggerRef logger;
TransfersContainer transfers;
AccountSubscription subscription;
std::string m_address;
};
}
Oops, something went wrong.

0 comments on commit abca087

Please sign in to comment.