Add session to reset call in cancel state

This commit is contained in:
nolash 2021-04-06 06:53:07 +02:00
parent 5dc9e8e698
commit b177bc8aa6
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 6 additions and 5 deletions

View File

@ -429,12 +429,13 @@ class Otx(SessionBase):
raise TxStateChangeError('CANCEL cannot be set on an entry with FINAL state set ({})'.format(status_str(self.status))) raise TxStateChangeError('CANCEL cannot be set on an entry with FINAL state set ({})'.format(status_str(self.status)))
if confirmed: if confirmed:
if self.status > 0 and not self.status & StatusBits.OBSOLETE: if self.status > 0 and self.status & (StatusBits.OBSOLETE & StatusBits.IN_NETWORK) == 0:
SessionBase.release_session(session) SessionBase.release_session(session)
raise TxStateChangeError('CANCEL can only be set on an entry marked OBSOLETE ({})'.format(status_str(self.status))) raise TxStateChangeError('CANCEL can only be set on an entry marked OBSOLETE ({})'.format(status_str(self.status)))
self.__set_status(StatusEnum.CANCELLED, session) self.__set_status(StatusEnum.FINAL, session)
else: self.__set_status(StatusEnum.OBSOLETED, session)
self.__set_status(StatusEnum.OBSOLETED, session)
self.__reset_status(StatusBits.RESERVED | StatusBits.QUEUED, session)
if self.tracing: if self.tracing:
self.__state_log(session=session) self.__state_log(session=session)

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = chainqueue name = chainqueue
version = 0.0.1a4 version = 0.0.1a5
description = Generic blockchain transaction queue control description = Generic blockchain transaction queue control
author = Louis Holbrook author = Louis Holbrook
author_email = dev@holbrook.no author_email = dev@holbrook.no