Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
a03b329a
Unverified
Commit
a03b329a
authored
Jan 25, 2021
by
Bastian Köcher
Committed by
GitHub
Jan 25, 2021
Browse files
Add a `convert_payload` function to `Signed` (#2320)
* Add a `convert_payload` function to `Signed` * Review feedback
parent
78e426ce
Pipeline
#121683
passed with stages
in 30 minutes and 51 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
node/primitives/src/lib.rs
View file @
a03b329a
...
@@ -85,6 +85,12 @@ impl Statement {
...
@@ -85,6 +85,12 @@ impl Statement {
}
}
}
}
impl
From
<&
'_
Statement
>
for
CompactStatement
{
fn
from
(
stmt
:
&
Statement
)
->
Self
{
stmt
.to_compact
()
}
}
impl
EncodeAs
<
CompactStatement
>
for
Statement
{
impl
EncodeAs
<
CompactStatement
>
for
Statement
{
fn
encode_as
(
&
self
)
->
Vec
<
u8
>
{
fn
encode_as
(
&
self
)
->
Vec
<
u8
>
{
self
.to_compact
()
.encode
()
self
.to_compact
()
.encode
()
...
...
primitives/src/v0.rs
View file @
a03b329a
...
@@ -921,6 +921,16 @@ impl<Payload: EncodeAs<RealPayload>, RealPayload: Encode> Signed<Payload, RealPa
...
@@ -921,6 +921,16 @@ impl<Payload: EncodeAs<RealPayload>, RealPayload: Encode> Signed<Payload, RealPa
pub
fn
into_payload
(
self
)
->
Payload
{
pub
fn
into_payload
(
self
)
->
Payload
{
self
.payload
self
.payload
}
}
/// Convert `Payload` into `RealPayload`.
pub
fn
convert_payload
(
&
self
)
->
Signed
<
RealPayload
>
where
for
<
'a
>
&
'a
Payload
:
Into
<
RealPayload
>
{
Signed
{
signature
:
self
.signature
.clone
(),
validator_index
:
self
.validator_index
,
payload
:
self
.payload
()
.into
(),
real_payload
:
sp_std
::
marker
::
PhantomData
,
}
}
}
}
/// Custom validity errors used in Polkadot while validating transactions.
/// Custom validity errors used in Polkadot while validating transactions.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment