chainqueue

Blockchain transaction queue control
Log | Files | Refs | LICENSE

commit b177bc8aa6fd6564dd1b889b38cdd73841b00e7c
parent 5dc9e8e698192fa4a71767307b3ceb5cf6257289
Author: nolash <dev@holbrook.no>
Date:   Tue,  6 Apr 2021 06:53:07 +0200

Add session to reset call in cancel state

Diffstat:
Mchainqueue/db/models/otx.py | 9+++++----
Msetup.cfg | 2+-
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/chainqueue/db/models/otx.py b/chainqueue/db/models/otx.py @@ -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))) 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) raise TxStateChangeError('CANCEL can only be set on an entry marked OBSOLETE ({})'.format(status_str(self.status))) - self.__set_status(StatusEnum.CANCELLED, session) - else: - self.__set_status(StatusEnum.OBSOLETED, session) + self.__set_status(StatusEnum.FINAL, session) + self.__set_status(StatusEnum.OBSOLETED, session) + + self.__reset_status(StatusBits.RESERVED | StatusBits.QUEUED, session) if self.tracing: self.__state_log(session=session) diff --git a/setup.cfg b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = chainqueue -version = 0.0.1a4 +version = 0.0.1a5 description = Generic blockchain transaction queue control author = Louis Holbrook author_email = dev@holbrook.no