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

Commit

Permalink
Rename TRANSACTION_VERSION to EXTRINSIC_VERSION (#7258)
Browse files Browse the repository at this point in the history
This renames the constant `TRANSACTION_VERSION` to `EXTRINSIC_VERSION`
to reflect the real usage.
  • Loading branch information
bkchr authored Oct 4, 2020
1 parent c0cb704 commit 6bcc385
Showing 1 changed file with 6 additions and 5 deletions.
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

0 comments on commit 6bcc385

Please sign in to comment.