Additional logs for own transactions (#4278)
This commit is contained in:
parent
b739704902
commit
fa02b3ae54
@ -37,7 +37,6 @@ use bit_set::BitSet;
|
|||||||
|
|
||||||
use util::*;
|
use util::*;
|
||||||
|
|
||||||
type CodePosition = usize;
|
|
||||||
type ProgramCounter = usize;
|
type ProgramCounter = usize;
|
||||||
|
|
||||||
const ONE: U256 = U256([1, 0, 0, 0]);
|
const ONE: U256 = U256([1, 0, 0, 0]);
|
||||||
|
@ -70,36 +70,43 @@ impl LocalTransactionsList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn mark_pending(&mut self, hash: H256) {
|
pub fn mark_pending(&mut self, hash: H256) {
|
||||||
|
debug!(target: "own_tx", "Imported to Current (hash {:?})", hash);
|
||||||
self.clear_old();
|
self.clear_old();
|
||||||
self.transactions.insert(hash, Status::Pending);
|
self.transactions.insert(hash, Status::Pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mark_future(&mut self, hash: H256) {
|
pub fn mark_future(&mut self, hash: H256) {
|
||||||
|
debug!(target: "own_tx", "Imported to Future (hash {:?})", hash);
|
||||||
self.transactions.insert(hash, Status::Future);
|
self.transactions.insert(hash, Status::Future);
|
||||||
self.clear_old();
|
self.clear_old();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mark_rejected(&mut self, tx: SignedTransaction, err: TransactionError) {
|
pub fn mark_rejected(&mut self, tx: SignedTransaction, err: TransactionError) {
|
||||||
|
debug!(target: "own_tx", "Transaction rejected (hash {:?}): {:?}", tx.hash(), err);
|
||||||
self.transactions.insert(tx.hash(), Status::Rejected(tx, err));
|
self.transactions.insert(tx.hash(), Status::Rejected(tx, err));
|
||||||
self.clear_old();
|
self.clear_old();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mark_replaced(&mut self, tx: SignedTransaction, gas_price: U256, hash: H256) {
|
pub fn mark_replaced(&mut self, tx: SignedTransaction, gas_price: U256, hash: H256) {
|
||||||
|
debug!(target: "own_tx", "Transaction replaced (hash {:?}) by {:?} (new gas price: {:?})", tx.hash(), hash, gas_price);
|
||||||
self.transactions.insert(tx.hash(), Status::Replaced(tx, gas_price, hash));
|
self.transactions.insert(tx.hash(), Status::Replaced(tx, gas_price, hash));
|
||||||
self.clear_old();
|
self.clear_old();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mark_invalid(&mut self, tx: SignedTransaction) {
|
pub fn mark_invalid(&mut self, tx: SignedTransaction) {
|
||||||
|
warn!(target: "own_tx", "Transaction marked invalid (hash {:?})", tx.hash());
|
||||||
self.transactions.insert(tx.hash(), Status::Invalid(tx));
|
self.transactions.insert(tx.hash(), Status::Invalid(tx));
|
||||||
self.clear_old();
|
self.clear_old();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mark_dropped(&mut self, tx: SignedTransaction) {
|
pub fn mark_dropped(&mut self, tx: SignedTransaction) {
|
||||||
|
warn!(target: "own_tx", "Transaction dropped (hash {:?})", tx.hash());
|
||||||
self.transactions.insert(tx.hash(), Status::Dropped(tx));
|
self.transactions.insert(tx.hash(), Status::Dropped(tx));
|
||||||
self.clear_old();
|
self.clear_old();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mark_mined(&mut self, tx: SignedTransaction) {
|
pub fn mark_mined(&mut self, tx: SignedTransaction) {
|
||||||
|
info!(target: "own_tx", "Transaction mined (hash {:?})", tx.hash());
|
||||||
self.transactions.insert(tx.hash(), Status::Mined(tx));
|
self.transactions.insert(tx.hash(), Status::Mined(tx));
|
||||||
self.clear_old();
|
self.clear_old();
|
||||||
}
|
}
|
||||||
|
@ -873,7 +873,6 @@ impl MinerService for Miner {
|
|||||||
pending: PendingTransaction,
|
pending: PendingTransaction,
|
||||||
) -> Result<TransactionImportResult, Error> {
|
) -> Result<TransactionImportResult, Error> {
|
||||||
|
|
||||||
let hash = pending.transaction.hash();
|
|
||||||
trace!(target: "own_tx", "Importing transaction: {:?}", pending);
|
trace!(target: "own_tx", "Importing transaction: {:?}", pending);
|
||||||
|
|
||||||
let imported = {
|
let imported = {
|
||||||
@ -885,12 +884,10 @@ impl MinerService for Miner {
|
|||||||
).pop().expect("one result returned per added transaction; one added => one result; qed");
|
).pop().expect("one result returned per added transaction; one added => one result; qed");
|
||||||
|
|
||||||
match import {
|
match import {
|
||||||
Ok(ref res) => {
|
Ok(_) => {
|
||||||
trace!(target: "own_tx", "Imported transaction to {:?} (hash: {:?})", res, hash);
|
|
||||||
trace!(target: "own_tx", "Status: {:?}", transaction_queue.status());
|
trace!(target: "own_tx", "Status: {:?}", transaction_queue.status());
|
||||||
},
|
},
|
||||||
Err(ref e) => {
|
Err(ref e) => {
|
||||||
trace!(target: "own_tx", "Failed to import transaction {:?} (hash: {:?})", e, hash);
|
|
||||||
trace!(target: "own_tx", "Status: {:?}", transaction_queue.status());
|
trace!(target: "own_tx", "Status: {:?}", transaction_queue.status());
|
||||||
warn!(target: "own_tx", "Error importing transaction: {:?}", e);
|
warn!(target: "own_tx", "Error importing transaction: {:?}", e);
|
||||||
},
|
},
|
||||||
|
@ -54,9 +54,6 @@ pub enum QueueAddError {
|
|||||||
LimitReached,
|
LimitReached,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Message Receiver type
|
|
||||||
pub type QueueEventReceiver = mpsc::Receiver<QueueEvent>;
|
|
||||||
|
|
||||||
// TODO [todr] to consider: timeout instead of limit?
|
// TODO [todr] to consider: timeout instead of limit?
|
||||||
const QUEUE_LIMIT: usize = 50;
|
const QUEUE_LIMIT: usize = 50;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user