@@ -686,11 +686,11 @@ def serialize_input(self, txin, script):
686686 # Script length, script, sequence
687687 s += var_int (len (script )/ 2 )
688688 s += script
689- s += int_to_hex (txin .get ('sequence' , 0xffffffff ), 4 )
689+ s += int_to_hex (txin .get ('sequence' , 0xffffffff - 1 ), 4 )
690690 return s
691691
692692 def set_rbf (self , rbf ):
693- nSequence = 0xffffffff - (2 if rbf else 0 )
693+ nSequence = 0xffffffff - (2 if rbf else 1 )
694694 for txin in self .inputs ():
695695 txin ['sequence' ] = nSequence
696696
@@ -716,12 +716,12 @@ def serialize_preimage(self, i):
716716 txin = inputs [i ]
717717 if self .is_segwit_input (txin ):
718718 hashPrevouts = Hash ('' .join (self .serialize_outpoint (txin ) for txin in inputs ).decode ('hex' )).encode ('hex' )
719- hashSequence = Hash ('' .join (int_to_hex (txin .get ('sequence' , 0xffffffff ), 4 ) for txin in inputs ).decode ('hex' )).encode ('hex' )
719+ hashSequence = Hash ('' .join (int_to_hex (txin .get ('sequence' , 0xffffffff - 1 ), 4 ) for txin in inputs ).decode ('hex' )).encode ('hex' )
720720 hashOutputs = Hash ('' .join (self .serialize_output (o ) for o in outputs ).decode ('hex' )).encode ('hex' )
721721 outpoint = self .serialize_outpoint (txin )
722722 scriptCode = push_script (self .get_preimage_script (txin ))
723723 amount = int_to_hex (txin ['value' ], 8 )
724- nSequence = int_to_hex (txin .get ('sequence' , 0xffffffff ), 4 )
724+ nSequence = int_to_hex (txin .get ('sequence' , 0xffffffff - 1 ), 4 )
725725 preimage = nVersion + hashPrevouts + hashSequence + outpoint + scriptCode + amount + nSequence + hashOutputs + nLocktime + nHashType
726726 else :
727727 txins = var_int (len (inputs )) + '' .join (self .serialize_input (txin , self .get_preimage_script (txin ) if i == k else '' ) for k , txin in enumerate (inputs ))
@@ -780,7 +780,7 @@ def get_fee(self):
780780 return self .input_value () - self .output_value ()
781781
782782 def is_final (self ):
783- return not any ([x .get ('sequence' , 0xffffffff ) < 0xffffffff - 1 for x in self .inputs ()])
783+ return not any ([x .get ('sequence' , 0xffffffff - 1 ) < 0xffffffff - 1 for x in self .inputs ()])
784784
785785 @profiler
786786 def estimated_size (self ):
0 commit comments