-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55fd93f
commit c7762fb
Showing
4 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,40 @@ | ||
use alloy_rlp::{RlpDecodable, RlpEncodable}; | ||
use serde::{Deserialize, Serialize}; | ||
use reth_codecs::derive_arbitrary; | ||
use reth_primitives::{Bytes, B256}; | ||
use reth_primitives::{Bytes, B256, hex}; | ||
|
||
#[derive_arbitrary(rlp)] | ||
#[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub struct UpgradeStatus { | ||
pub extension : Vec<Bytes> | ||
} | ||
pub extension : Vec<u8> | ||
} | ||
|
||
#[derive_arbitrary(rlp)] | ||
#[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub struct UpgradeStatusExtension { | ||
pub disable_peer_tx_broadcast: bool | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use std::path::Path; | ||
use alloy_rlp::Encodable; | ||
use reth_primitives::hex; | ||
use crate::{EthMessage, ProtocolMessage}; | ||
|
||
#[test] | ||
fn test_encode_upgrade_status() { | ||
let extension = UpgradeStatusExtension{disable_peer_tx_broadcast: false}; | ||
let mut buffer = Vec::<u8>::new(); | ||
let _ = extension.encode(&mut buffer); | ||
let result = alloy_rlp::encode(ProtocolMessage::from(EthMessage::UpgradeStatus(UpgradeStatus{ | ||
extension: buffer, | ||
}))); | ||
|
||
println!("{}", hex::encode(result)) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters