1- // Copyright 2019 Kodebox, Inc.
1+ // Copyright 2019-2020 Kodebox, Inc.
22// This file is part of CodeChain.
33//
44// This program is free software: you can redistribute it and/or modify
@@ -33,21 +33,17 @@ pub enum TxOrigin {
3333 Local ,
3434 /// External transaction received from network
3535 External ,
36- /// Transaction from retracted blocks
37- RetractedBlock ,
3836}
3937
4038type TxOriginType = u8 ;
4139const LOCAL : TxOriginType = 0x01 ;
4240const EXTERNAL : TxOriginType = 0x02 ;
43- const RETRACTEDBLOCK : TxOriginType = 0x03 ;
4441
4542impl Encodable for TxOrigin {
4643 fn rlp_append ( & self , s : & mut RlpStream ) {
4744 match self {
4845 TxOrigin :: Local => LOCAL . rlp_append ( s) ,
4946 TxOrigin :: External => EXTERNAL . rlp_append ( s) ,
50- TxOrigin :: RetractedBlock => RETRACTEDBLOCK . rlp_append ( s) ,
5147 } ;
5248 }
5349}
@@ -57,7 +53,6 @@ impl Decodable for TxOrigin {
5753 match d. as_val ( ) . expect ( "rlp decode Error" ) {
5854 LOCAL => Ok ( TxOrigin :: Local ) ,
5955 EXTERNAL => Ok ( TxOrigin :: External ) ,
60- RETRACTEDBLOCK => Ok ( TxOrigin :: RetractedBlock ) ,
6156 _ => Err ( DecoderError :: Custom ( "Unexpected Txorigin type" ) ) ,
6257 }
6358 }
@@ -76,8 +71,6 @@ impl Ord for TxOrigin {
7671 }
7772
7873 match ( * self , * other) {
79- ( TxOrigin :: RetractedBlock , _) => Ordering :: Less ,
80- ( _, TxOrigin :: RetractedBlock ) => Ordering :: Greater ,
8174 ( TxOrigin :: Local , _) => Ordering :: Less ,
8275 _ => Ordering :: Greater ,
8376 }
@@ -89,10 +82,6 @@ impl TxOrigin {
8982 self == TxOrigin :: Local
9083 }
9184
92- pub fn is_local_or_retracted ( self ) -> bool {
93- self == TxOrigin :: Local || self == TxOrigin :: RetractedBlock
94- }
95-
9685 pub fn is_external ( self ) -> bool {
9786 self == TxOrigin :: External
9887 }
@@ -329,7 +318,7 @@ impl CurrentQueue {
329318
330319 pub fn insert ( & mut self , order : TransactionOrder ) {
331320 self . queue . insert ( order) ;
332- if !order. origin . is_local_or_retracted ( ) {
321+ if !order. origin . is_local ( ) {
333322 self . mem_usage += order. mem_usage ;
334323 self . count += 1 ;
335324 }
@@ -338,7 +327,7 @@ impl CurrentQueue {
338327
339328 pub fn remove ( & mut self , order : & TransactionOrder ) {
340329 assert ! ( self . queue. remove( order) ) ;
341- if !order. origin . is_local_or_retracted ( ) {
330+ if !order. origin . is_local ( ) {
342331 self . mem_usage -= order. mem_usage ;
343332 self . count -= 1 ;
344333 }
@@ -388,15 +377,15 @@ impl FutureQueue {
388377
389378 pub fn insert ( & mut self , order : TransactionOrder ) {
390379 self . queue . insert ( order) ;
391- if !order. origin . is_local_or_retracted ( ) {
380+ if !order. origin . is_local ( ) {
392381 self . mem_usage += order. mem_usage ;
393382 self . count += 1 ;
394383 }
395384 }
396385
397386 pub fn remove ( & mut self , order : & TransactionOrder ) {
398387 assert ! ( self . queue. remove( order) ) ;
399- if !order. origin . is_local_or_retracted ( ) {
388+ if !order. origin . is_local ( ) {
400389 self . mem_usage -= order. mem_usage ;
401390 self . count -= 1 ;
402391 }
0 commit comments