Skip to content

Commit 12b6846

Browse files
authored
Merge pull request #295 from DMDcoin/0.12
v0.12.7
2 parents afee4e1 + 358d190 commit 12b6846

File tree

16 files changed

+164
-35
lines changed

16 files changed

+164
-35
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
## Diamond Node Software 0.12.7
3+
4+
- [hbbft key generation: double transactions / missing transactions](https://github.com/DMDcoin/diamond-node/issues/290)
5+
26
## Diamond Node Software 0.12.6
37

48
- reduced Trace Log output for tracing devp2p propagation

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "Diamond Node"
33
name = "diamond-node"
44
# NOTE Make sure to update util/version/Cargo.toml as well
5-
version = "0.12.6"
5+
version = "0.12.7"
66
license = "GPL-3.0"
77
authors = [
88
"bit.diamonds developers",

crates/concensus/miner/src/pool/queue.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,20 @@ impl TransactionQueue {
546546
)
547547
}
548548

549+
/// Returns status of a local transaction by its hash.
550+
pub fn local_transaction_status(
551+
&self,
552+
tx_hash: &H256,
553+
) -> Option<crate::pool::local_transactions::Status> {
554+
self.pool
555+
.read()
556+
.listener()
557+
.0
558+
.all_transactions()
559+
.get(tx_hash)
560+
.cloned()
561+
}
562+
549563
/// Collect pending transactions.
550564
///
551565
/// NOTE This is re-computing the pending set and it might be expensive to do so.

crates/ethcore/src/client/client.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ use ansi_term::Colour;
8989
use bytes::{Bytes, ToPretty};
9090
use call_contract::{CallContract, RegistryInfo};
9191
use db::{DBTransaction, DBValue, KeyValueDB};
92-
use ethcore_miner::pool::VerifiedTransaction;
92+
use ethcore_miner::pool::{VerifiedTransaction, local_transactions::Status};
9393
use ethereum_types::{Address, H256, H264, H512, U256};
9494
use hash::keccak;
9595
use itertools::Itertools;
@@ -1410,6 +1410,16 @@ impl Client {
14101410
}
14111411
}
14121412

1413+
/// Get local transactions from the miner.
1414+
pub fn local_transactions(&self) -> BTreeMap<H256, Status> {
1415+
self.importer.miner.local_transactions()
1416+
}
1417+
1418+
/// Get local transactions from the miner.
1419+
pub fn local_transaction_status(&self, tx_hash: &H256) -> Option<Status> {
1420+
self.importer.miner.local_transaction_status(tx_hash)
1421+
}
1422+
14131423
/// Get shared miner reference.
14141424
#[cfg(test)]
14151425
pub fn miner(&self) -> Arc<Miner> {
@@ -3360,6 +3370,11 @@ impl super::traits::EngineClient for Client {
33603370
.miner
33613371
.create_pending_block_at(self, txns, timestamp, block_number)
33623372
}
3373+
3374+
/// Get local transactions from the miner.
3375+
fn local_transaction_status(&self, tx_hash: &H256) -> Option<Status> {
3376+
self.importer.miner.local_transaction_status(tx_hash)
3377+
}
33633378
}
33643379

33653380
impl ProvingBlockChainClient for Client {

crates/ethcore/src/client/test_client.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use crate::{
4848
use bytes::Bytes;
4949
use crypto::publickey::{Generator, Random};
5050
use db::{COL_STATE, NUM_COLUMNS};
51-
use ethcore_miner::pool::VerifiedTransaction;
51+
use ethcore_miner::pool::{VerifiedTransaction, local_transactions::Status};
5252
use ethereum_types::{Address, H256, H512, U256};
5353
use ethtrie;
5454
use hash::keccak;
@@ -1274,6 +1274,10 @@ impl super::traits::EngineClient for TestBlockChainClient {
12741274
}
12751275

12761276
fn demand_shutdown(&self) {}
1277+
1278+
fn local_transaction_status(&self, tx_hash: &H256) -> Option<Status> {
1279+
self.miner.local_transaction_status(tx_hash)
1280+
}
12771281
}
12781282

12791283
impl PrometheusMetrics for TestBlockChainClient {

crates/ethcore/src/client/traits.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use crate::{
4545
};
4646
use bytes::Bytes;
4747
use call_contract::{CallContract, RegistryInfo};
48-
use ethcore_miner::pool::VerifiedTransaction;
48+
use ethcore_miner::pool::{VerifiedTransaction, local_transactions::Status};
4949
use ethereum_types::{Address, H256, H512, U256};
5050
use evm::Schedule;
5151
use itertools::Itertools;
@@ -707,6 +707,12 @@ pub trait EngineClient: Sync + Send + ChainInfo {
707707
fn config_shutdown_on_missing_block_import(&self) -> Option<u64> {
708708
None
709709
}
710+
711+
/// Get local transaction status.
712+
/// Note that already included transactions might be not available here anymore.
713+
/// As well as transactions that were culled, replaced, dropped or whatever,
714+
/// do not exist forever in the memory.
715+
fn local_transaction_status(&self, tx_hash: &H256) -> Option<Status>;
710716
}
711717

712718
/// Extended client interface for providing proofs of the state.

crates/ethcore/src/engines/hbbft/contracts/validator_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn is_pending_validator(
8181
call_const_validator!(c, is_pending_validator, staking_address.clone())
8282
}
8383

84-
#[derive(PartialEq)]
84+
#[derive(PartialEq, Debug)]
8585
pub enum KeyGenMode {
8686
WritePart,
8787
WriteAck,

crates/ethcore/src/engines/hbbft/hbbft_engine.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ impl HoneyBadgerBFT {
461461
let engine = Arc::new(HoneyBadgerBFT {
462462
transition_service: IoService::<()>::start("Hbbft", 4)?,
463463
hbbft_peers_service: IoService::<HbbftConnectToPeersMessage>::start(
464-
"peers_management",
464+
"hbbftp", /* hbbft peers (we use 6 letter acronyms for nice log file layout.) */
465465
1,
466466
)?,
467467
client: Arc::new(RwLock::new(None)),
@@ -484,7 +484,9 @@ impl HoneyBadgerBFT {
484484
params,
485485
message_counter: Mutex::new(0), // restore message counter from memory here for RBC ? */
486486
random_numbers: RwLock::new(BTreeMap::new()),
487-
keygen_transaction_sender: RwLock::new(KeygenTransactionSender::new()),
487+
/* Todo: make this configureable
488+
*/
489+
keygen_transaction_sender: RwLock::new(KeygenTransactionSender::new(1, 60000)),
488490

489491
has_connected_to_validator_set: AtomicBool::new(false),
490492
current_minimum_gas_price: Mutex::new(None),

crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl HbbftPeersManagement {
9191
) {
9292
connected_current_pending_validators.push(connected_validator);
9393
} else {
94-
warn!(target: "Engine", "could not add pending validator to reserved peers: {}", pending_validator_address);
94+
debug!(target: "Engine", "could not add pending validator to reserved peers: {}", pending_validator_address);
9595
}
9696
}
9797
}
@@ -546,7 +546,7 @@ fn connect_to_validator_core(
546546
};
547547

548548
if socket_addr.port() == 0 {
549-
error!(target: "engine", "connect_to_validator_core: no port specified for Node ( Public (NodeId): {:?} , staking address: {}, socket_addr: {:?}", node_id, staking_address, socket_addr);
549+
debug!(target: "engine", "connect_to_validator_core: no port specified for Node ( Public (NodeId): {:?} , staking address: {}, socket_addr: {:?}", node_id, staking_address, socket_addr);
550550
// we interprate port 0 as NULL.
551551
return None;
552552
}

0 commit comments

Comments
 (0)