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

fix incorrect reported txid in txpool rpc #674

Merged
merged 4 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/rpc/txpool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ license = 'GPL-3.0-only'
repository = 'https://github.com/PureStake/moonbeam/'

[dependencies]
rlp = "0.5"
sha3 = "0.8"
jsonrpc-core = "15.0.0"
ethereum-types = "0.11.0"
ethereum = { version = "0.7.1", default-features = false, features = ["with-codec"] }
moonbeam-rpc-core-txpool = { path = "../../rpc-core/txpool" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" }
Expand Down
7 changes: 2 additions & 5 deletions client/rpc/txpool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.

use ethereum::TransactionMessage;
use ethereum_types::{H160, H256, U256};
use fc_rpc::{internal_err, public_key};
use jsonrpc_core::Result as RpcResult;
Expand Down Expand Up @@ -83,8 +82,7 @@ where
// Build the T response.
let mut pending = TransactionMap::<T>::new();
for txn in ethereum_txns.ready.iter() {
let transaction_message = TransactionMessage::from(txn.clone());
let hash = transaction_message.hash();
let hash = H256::from_slice(Keccak256::digest(&rlp::encode(txn)).as_slice());
let from_address = match public_key(txn) {
Ok(pk) => H160::from(H256::from_slice(Keccak256::digest(&pk).as_slice())),
Err(_e) => H160::default(),
Expand All @@ -96,8 +94,7 @@ where
}
let mut queued = TransactionMap::<T>::new();
for txn in ethereum_txns.future.iter() {
let transaction_message = TransactionMessage::from(txn.clone());
let hash = transaction_message.hash();
let hash = H256::from_slice(Keccak256::digest(&rlp::encode(txn)).as_slice());
let from_address = match public_key(txn) {
Ok(pk) => H160::from(H256::from_slice(Keccak256::digest(&pk).as_slice())),
Err(_e) => H160::default(),
Expand Down