Skip to content
This repository has been archived by the owner on Apr 16, 2023. It is now read-only.

Commit

Permalink
Resolves #1083 (#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonlehmann committed Jul 26, 2020
1 parent 4cadd7c commit a0bf8fd
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
20 changes: 20 additions & 0 deletions src/common/TransactionExtra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,26 @@ namespace CryptoNote
}

bool addExtraNonceToTransactionExtra(std::vector<uint8_t> &tx_extra, const BinaryArray &extra_nonce)
{
if (extra_nonce.size() > TX_EXTRA_NONCE_MAX_COUNT)
{
return false;
}

size_t start_pos = tx_extra.size();
tx_extra.resize(tx_extra.size() + 2 + extra_nonce.size());
// write tag
tx_extra[start_pos] = TX_EXTRA_NONCE;
// write len
++start_pos;
tx_extra[start_pos] = static_cast<uint8_t>(extra_nonce.size());
// write data
++start_pos;
memcpy(&tx_extra[start_pos], extra_nonce.data(), extra_nonce.size());
return true;
}

bool addPoolNonceToTransactionExtra(std::vector<uint8_t> &tx_extra, const BinaryArray &extra_nonce)
{
size_t start_pos = tx_extra.size();
tx_extra.resize(tx_extra.size() + 2 + extra_nonce.size());
Expand Down
2 changes: 2 additions & 0 deletions src/common/TransactionExtra.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ namespace CryptoNote

bool addExtraNonceToTransactionExtra(std::vector<uint8_t> &tx_extra, const BinaryArray &extra_nonce);

bool addPoolNonceToTransactionExtra(std::vector<uint8_t> &tx_extra, const BinaryArray &extra_nonce);

void setPaymentIdToTransactionExtraNonce(BinaryArray &extra_nonce, const Crypto::Hash &payment_id);

bool getPaymentIdFromTransactionExtraNonce(const BinaryArray &extra_nonce, Crypto::Hash &payment_id);
Expand Down
4 changes: 2 additions & 2 deletions src/config/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#define PROJECT_COPYRIGHT "Copyright 2018-2020, The TurtleCoin Developers"
#define APP_VER_MAJOR 0
#define APP_VER_MINOR 28
#define APP_VER_REV 0
#define APP_VER_BUILD 1302
#define APP_VER_REV 1
#define APP_VER_BUILD 1303

#define BUILD_COMMIT_ID "@VERSION@"
#define PROJECT_VERSION STR(APP_VER_MAJOR) "." STR(APP_VER_MINOR) "." STR(APP_VER_REV)
Expand Down
2 changes: 1 addition & 1 deletion src/cryptonotecore/Currency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ namespace CryptoNote
addTransactionPublicKeyToExtra(tx.extra, txkey.publicKey);
if (!extraNonce.empty())
{
if (!addExtraNonceToTransactionExtra(tx.extra, extraNonce))
if (!addPoolNonceToTransactionExtra(tx.extra, extraNonce))
{
return false;
}
Expand Down

0 comments on commit a0bf8fd

Please sign in to comment.