p2p: Add wrappers for messages that use `Vec`
In preparation to move `p2p` to its own crate, any `Vec<T>` that satisfies `T: Encodable` will not trivially implement `Encodable` because of the orphan rule. A type defined within p2p may implement `Encodable`, however, and the simplest possible type is one that simply wraps the vector. Three types that will implement `Encodable` within `p2p` are added here.
This commit is contained in:
parent
5e0b86d2b1
commit
94bcff28b1
|
@ -163,6 +163,18 @@ pub struct V2NetworkMessage {
|
|||
payload: NetworkMessage,
|
||||
}
|
||||
|
||||
/// A list of inventory items.
|
||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||
pub struct InventoryPayload(pub Vec<message_blockdata::Inventory>);
|
||||
|
||||
/// A list of legacy p2p address messages.
|
||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||
pub struct AddrPayload(pub Vec<(u32, Address)>);
|
||||
|
||||
/// A list of v2 address messages.
|
||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||
pub struct AddrV2Payload(pub Vec<AddrV2Message>);
|
||||
|
||||
/// A Network message payload. Proper documentation is available on at
|
||||
/// [Bitcoin Wiki: Protocol Specification](https://en.bitcoin.it/wiki/Protocol_specification)
|
||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||
|
|
Loading…
Reference in New Issue