Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Rename TRANSACTION_VERSION to EXTRINSIC_VERSION #7258

Merged
merged 1 commit into from
Oct 4, 2020
Merged
Changes from all commits
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
11 changes: 6 additions & 5 deletions primitives/runtime/src/generic/unchecked_extrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ use crate::{
OpaqueExtrinsic,
};

const TRANSACTION_VERSION: u8 = 4;
/// Current version of the [`UncheckedExtrinsic`] format.
const EXTRINSIC_VERSION: u8 = 4;

/// A extrinsic right from the external world. This is unchecked and so
/// can contain a signature.
Expand Down Expand Up @@ -151,7 +152,7 @@ impl<Address, Call, Signature, Extra> ExtrinsicMetadata
where
Extra: SignedExtension,
{
const VERSION: u8 = TRANSACTION_VERSION;
const VERSION: u8 = EXTRINSIC_VERSION;
type SignedExtensions = Extra;
}

Expand Down Expand Up @@ -233,7 +234,7 @@ where

let is_signed = version & 0b1000_0000 != 0;
let version = version & 0b0111_1111;
if version != TRANSACTION_VERSION {
if version != EXTRINSIC_VERSION {
return Err("Invalid transaction version".into());
}

Expand All @@ -257,11 +258,11 @@ where
// 1 byte version id.
match self.signature.as_ref() {
Some(s) => {
v.push(TRANSACTION_VERSION | 0b1000_0000);
v.push(EXTRINSIC_VERSION | 0b1000_0000);
s.encode_to(v);
}
None => {
v.push(TRANSACTION_VERSION & 0b0111_1111);
v.push(EXTRINSIC_VERSION & 0b0111_1111);
}
}
self.function.encode_to(v);
Expand Down