Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check transaction before broadcasting / accepting #3046

Open
wants to merge 1 commit into
base: testnet3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions node/rest/src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ impl<N: Network, C: ConsensusStorage<N>, R: Routing<N>> Rest<N, C, R> {
State(rest): State<Self>,
Json(tx): Json<Transaction<N>>,
) -> Result<ErasedJson, RestError> {
// Check if the transaction is well-formed.
rest.ledger
.check_transaction_basic(&tx, None, &mut rand::thread_rng())
.map_err(|e| RestError(format!("Invalid transaction: {e}")))?;

// If the consensus module is enabled, add the unconfirmed transaction to the memory pool.
if let Some(consensus) = rest.consensus {
// Add the unconfirmed transaction to the memory pool.
Expand Down