Compare commits

...

12 Commits

@ -413,7 +413,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
else()
set(DEFAULT_BUILD_DEBUG_UTILITIES OFF)
endif()
option(BUILD_DEBUG_UTILITIES "Build debug utilities." DEFAULT_BUILD_DEBUG_UTILITIES)
option(BUILD_DEBUG_UTILITIES "Build debug utilities." ${DEFAULT_BUILD_DEBUG_UTILITIES})
if(OSSFUZZ)
message(STATUS "Using OSS-Fuzz fuzzing system")

@ -130,6 +130,15 @@ release-static-android-armv8:
cd $(builddir)/release/translations && cmake ../../../translations && $(MAKE)
cd $(builddir)/release && CC=aarch64-linux-android-clang CXX=aarch64-linux-android-clang++ cmake -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D ANDROID=true -D BUILD_TAG="android-armv8" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARCH_ABI="arm64-v8a" ../.. && $(MAKE)
release-static-android-armv8-wallet_api:
mkdir -p $(builddir)/release
cd $(builddir)/release && CC=aarch64-linux-android-clang CXX=aarch64-linux-android-clang++ cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D ANDROID=true -D BUILD_TAG="android-armv8" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARCH_ABI="arm64-v8a" ../.. && $(MAKE) wallet_api
release-static-android-x86_64-wallet_api:
mkdir -p $(builddir)/release
cd $(builddir)/release && CC=x86_64-linux-android-clang CXX=x86_64-linux-android-clang++ cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="x86-64" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D ANDROID=true -D BUILD_TAG="android-x86_64" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARCH_ABI="x86_64" ../.. && $(MAKE) wallet_api
release-static-linux-armv8:
mkdir -p $(builddir)/release
cd $(builddir)/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="linux-armv8" $(topdir) && $(MAKE)

@ -1251,6 +1251,7 @@ namespace cryptonote
{
LOG_PRINT_L0("[on_send_raw_tx]: Failed to parse tx from hexbuff: " << req.tx_as_hex);
res.status = "Failed";
res.reason = "Hex decoding failed";
return true;
}

@ -434,6 +434,9 @@ WalletImpl::WalletImpl(NetworkType nettype, uint64_t kdf_rounds)
m_refreshIntervalMillis = DEFAULT_REFRESH_INTERVAL_MILLIS;
m_refreshThread = boost::thread([this] () {
this->refreshThreadFunc();
});
}
WalletImpl::~WalletImpl()

@ -3851,7 +3851,7 @@ void wallet2::detach_blockchain(uint64_t height, std::map<std::pair<uint64_t, ui
transfers_detached = std::distance(it, m_transfers.end());
m_transfers.erase(it, m_transfers.end());
size_t blocks_detached = m_blockchain.size() - height;
const uint64_t blocks_detached = m_blockchain.size() - height;
m_blockchain.crop(height);
for (auto it = m_payments.begin(); it != m_payments.end(); )
@ -3870,6 +3870,9 @@ void wallet2::detach_blockchain(uint64_t height, std::map<std::pair<uint64_t, ui
++it;
}
if (m_callback)
m_callback->on_reorg(height, blocks_detached, transfers_detached);
LOG_PRINT_L0("Detached blockchain on height " << height << ", transfers detached " << transfers_detached << ", blocks detached " << blocks_detached);
}
//----------------------------------------------------------------------------------------------------
@ -5852,11 +5855,12 @@ bool wallet2::check_hard_fork_version(cryptonote::network_type nettype, const st
// First check if wallet or daemon is outdated (whether either are unaware of
// a hard fork). Then check if fork has passed rendering versions incompatible
if (daemon_hard_forks.size() > 0)
{
// Block 0 in Wownero starts from version 7
bool daemon_outdated = daemon_hard_forks.size() + 6 < wallet_num_hard_forks;
bool wallet_outdated = daemon_hard_forks.size() + 6 > wallet_num_hard_forks;
bool daemon_outdated = daemon_hard_forks.size() < wallet_num_hard_forks;
bool wallet_outdated = daemon_hard_forks.size() > wallet_num_hard_forks;
if (daemon_is_outdated)
*daemon_is_outdated = daemon_outdated;
@ -5865,7 +5869,7 @@ bool wallet2::check_hard_fork_version(cryptonote::network_type nettype, const st
if (daemon_outdated)
{
uint64_t daemon_missed_fork_height = wallet_hard_forks[daemon_hard_forks.size() + 6].height;
uint64_t daemon_missed_fork_height = wallet_hard_forks[daemon_hard_forks.size()].height;
// If the daemon missed the fork, then technically it is no longer part of
// the Monero network. Don't connect.
@ -6930,6 +6934,24 @@ void wallet2::commit_tx(pending_tx& ptx)
crypto::hash txid;
txid = get_transaction_hash(ptx.tx);
// if it's already processed, bail
if (std::find_if(m_transfers.begin(), m_transfers.end(), [&txid](const transfer_details &td) { return td.m_txid == txid; }) != m_transfers.end())
{
MDEBUG("Transaction " << txid << " already processed");
return;
}
if (m_unconfirmed_txs.find(txid) != m_unconfirmed_txs.end())
{
MDEBUG("Transaction " << txid << " already processed");
return;
}
if (m_confirmed_txs.find(txid) != m_confirmed_txs.end())
{
MDEBUG("Transaction " << txid << " already processed");
return;
}
crypto::hash payment_id = crypto::null_hash;
std::vector<cryptonote::tx_destination_entry> dests;
uint64_t amount_in = 0;

@ -138,6 +138,7 @@ private:
public:
// Full wallet callbacks
virtual void on_new_block(uint64_t height, const cryptonote::block& block) {}
virtual void on_reorg(uint64_t height, uint64_t blocks_detached, size_t transfers_detached) {}
virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, uint64_t burnt, const cryptonote::subaddress_index& subaddr_index, bool is_change, uint64_t unlock_time) {}
virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, const cryptonote::subaddress_index& subaddr_index) {}
virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& in_tx, uint64_t amount, const cryptonote::transaction& spend_tx, const cryptonote::subaddress_index& subaddr_index) {}

@ -576,9 +576,9 @@ namespace tools
if (!m_wallet) return not_open(er);
try
{
if (req.count < 1 || req.count > 64) {
if (req.count < 1 || req.count > 65536) {
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
er.message = "Count must be between 1 and 64.";
er.message = "Count must be between 1 and 65536.";
return false;
}

@ -52,6 +52,7 @@ class TransferTest():
self.check_tx_notes()
self.check_rescan()
self.check_is_key_image_spent()
self.check_multiple_submissions()
def reset(self):
print('Resetting blockchain')
@ -829,6 +830,39 @@ class TransferTest():
res = daemon.is_key_image_spent(ki)
assert res.spent_status == expected
def check_multiple_submissions(self):
daemon = Daemon()
print('Testing multiple submissions')
dst = {'address': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'amount': 1000000000000}
self.wallet[0].refresh()
res = self.wallet[0].get_balance()
balance = res.balance
res = self.wallet[0].transfer([dst], ring_size = 16, get_tx_key = False, get_tx_hex = False, get_tx_metadata = True)
tx_hex = res.tx_metadata
tx_fee = res.fee
res = self.wallet[0].relay_tx(tx_hex)
# submit again before mined
res = self.wallet[0].relay_tx(tx_hex)
daemon.generateblocks('44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW', 1)
self.wallet[0].refresh()
res = self.wallet[0].get_balance()
assert res.balance == balance - tx_fee
balance = res.balance
# submit again after mined
res = self.wallet[0].relay_tx(tx_hex)
daemon.generateblocks('44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW', 1)
self.wallet[0].refresh()
res = self.wallet[0].get_balance()
assert res.balance == balance
if __name__ == '__main__':
TransferTest().run_test()

Loading…
Cancel
Save