From 24b3e9007a8ad0684edcee51df444b21a033e4ba Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 27 Mar 2016 12:35:36 +0100 Subject: Convey tx verification failure reasons to the RPC client This allows appropriate action to be taken, like displaying the reason to the user. Do just that in simplewallet, which should help a lot in determining why users fail to send. Also make it so a tx which is accepted but not relayed is seen as a success rather than a failure. --- src/cryptonote_core/blockchain.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/cryptonote_core/blockchain.h') diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h index 393faef2a..db930cf97 100644 --- a/src/cryptonote_core/blockchain.h +++ b/src/cryptonote_core/blockchain.h @@ -472,11 +472,12 @@ namespace cryptonote * @param tx the transaction to validate * @param pmax_used_block_height return-by-reference block height of most recent input * @param max_used_block_id return-by-reference block hash of most recent input + * @param tvc returned information about tx verification * @param kept_by_block whether or not the transaction is from a previously-verified block * * @return false if any input is invalid, otherwise true */ - bool check_tx_inputs(const transaction& tx, uint64_t& pmax_used_block_height, crypto::hash& max_used_block_id, bool kept_by_block = false); + bool check_tx_inputs(const transaction& tx, uint64_t& pmax_used_block_height, crypto::hash& max_used_block_id, tx_verification_context &tvc, bool kept_by_block = false); /** * @brief check that a transaction's outputs conform to current standards @@ -486,10 +487,11 @@ namespace cryptonote * written out would have only one non-zero digit in base 10). * * @param tx the transaction to check the outputs of + * @param tvc returned info about tx verification * * @return false if any outputs do not conform, otherwise true */ - bool check_tx_outputs(const transaction& tx); + bool check_tx_outputs(const transaction& tx, tx_verification_context &tvc); /** * @brief gets the blocksize limit based on recent blocks @@ -874,11 +876,12 @@ namespace cryptonote * transaction. * * @param tx the transaction to validate + * @param tvc returned information about tx verification * @param pmax_related_block_height return-by-pointer the height of the most recent block in the input set * * @return false if any validation step fails, otherwise true */ - bool check_tx_inputs(const transaction& tx, uint64_t* pmax_used_block_height = NULL); + bool check_tx_inputs(const transaction& tx, tx_verification_context &tvc, uint64_t* pmax_used_block_height = NULL); /** * @brief performs a blockchain reorganization according to the longest chain rule -- cgit v1.2.3 From 4cfb4dff3e8ae213cc87b2d0234a519d2e8674b7 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 6 Apr 2016 18:56:33 +0100 Subject: blockchain: remove the tx validation result cache As pointed out by smooth, a transaction's validity may change over time as the blockchain changes. --- src/cryptonote_core/blockchain.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/cryptonote_core/blockchain.h') diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h index a62487d1e..21086d578 100644 --- a/src/cryptonote_core/blockchain.h +++ b/src/cryptonote_core/blockchain.h @@ -790,7 +790,6 @@ namespace cryptonote // metadata containers std::unordered_map>> m_scan_table; - std::unordered_map> m_check_tx_inputs_table; std::unordered_map m_blocks_longhash_table; std::unordered_map> m_check_txin_table; -- cgit v1.2.3